Hi all, I was wondering if there is a way to output text tables with the color of the text corresponding to a condition. More specifically, I"m outputting an time series table and want the console colors to be green>0 and red<0. This is very easy to do in excel using conditional formatting. Any ideas on how to do it here? thanks. P.S. I've thought about using a heatmap, but it might be complicated using an ts series object. -- View this message in context: http://n4.nabble.com/outputing-text-colors-tp1598874p1598874.html Sent from the R help mailing list archive at Nabble.com.
Tena koe Perhaps the thread started earlier this week ([R] How good is R at making publication quality tables?) would help you. HTH .... Peter Alspach> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of rtist > Sent: Friday, 19 March 2010 2:37 p.m. > To: r-help at r-project.org > Subject: [R] outputing text colors > > > Hi all, > > I was wondering if there is a way to output text tables with the color > of > the text corresponding to a condition. > > More specifically, I"m outputting an time series table and want the > console > colors to be green>0 and red<0. > This is very easy to do in excel using conditional formatting. Any > ideas on > how to do it here? > > thanks. > P.S. I've thought about using a heatmap, but it might be complicated > using > an ts series object. > -- > View this message in context: http://n4.nabble.com/outputing-text- > colors-tp1598874p1598874.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.
On 03/19/2010 12:37 PM, rtist wrote:> > Hi all, > > I was wondering if there is a way to output text tables with the color of > the text corresponding to a condition. > > More specifically, I"m outputting an time series table and want the console > colors to be green>0 and red<0. > This is very easy to do in excel using conditional formatting. Any ideas on > how to do it here? >Hi rtist, If you want the whole table to be displayed in a color, you could do something like: par(fg=ifelse(something > 0,"green","red")) before you display the table. I am assuming that you want this on a graphics device, not the console in which R is running. Jim
Another possibility (depending on what you want to do/preferences) is to create a text file that can be postprocessed to give the colors. One example of this is the etxtStart and related functions in the TeachingDemos package. These produce a text file with extra notations that when processed with the enscript program includes different text colors. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of rtist > Sent: Thursday, March 18, 2010 7:37 PM > To: r-help at r-project.org > Subject: [R] outputing text colors > > > Hi all, > > I was wondering if there is a way to output text tables with the color > of > the text corresponding to a condition. > > More specifically, I"m outputting an time series table and want the > console > colors to be green>0 and red<0. > This is very easy to do in excel using conditional formatting. Any > ideas on > how to do it here? > > thanks. > P.S. I've thought about using a heatmap, but it might be complicated > using > an ts series object. > -- > View this message in context: http://n4.nabble.com/outputing-text- > colors-tp1598874p1598874.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.