[R] outputing text colors

Jim Lemon jim at bitwrit.com.au
Fri Mar 19 07:28:56 CET 2010


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



More information about the R-help mailing list