Dear R-List, is it possible to format elements of a character vector in different colors and how would this be achieved?
Problem: Suppose, you have a model for forecasting purposes. Beside the forecast [variable: 'forecast' in the example below] a forecast interval is also computed [variable: 'int' in the example below. The forecast should now be translated in verbal terms if the forecast interval is below or above a certain threshold value [in the example below, this value is set to 50]. After evaluation the object text should be formatted in either "green", or "red", or "black". outcome <- c("positive","negative","neutral") forecast <- 60 int <- c(55,65) # text <- outcome[3] text[forecast > 50 & int[1] > 50] <- outcome[1] text[forecast < 50 & int[2] < 50] <- outcome[2] text I tried the following outcome <- c("positive","negative","neutral")[col=c("green","red","black"] without success, i.e. three times "na" formatted in green is returned. I did also check the former help-emails without finding any pointers to solve my problem. As a side note: the object 'text' will be used in the supplementary package R2HTML. I want to avoid programming the conditional colouring with ASP by reading in an ascii-file that holds the value of 'text' and hence not using R2HTML at all. R: 1.61 OS: Windows NT i386 Any help or hints are warmly appreciated. Bernhard ---------------------------------------------------------------------- If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. ---------------------------------------------------------------------- ______________________________________________ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help