[R] conditional coloring of output text in console or in GUI

Paolo paolo.sonego at gmail.com
Wed Jul 1 09:31:17 CEST 2009


Christopher W. Ryan <cryan <at> binghamton.edu> writes:

> 
> suppose I have some logical vector
> 
> x <- as.logical(c(0,0,0,1,0,0,1,1,0))
> x
> 
> How would I make the words TRUE appear on the screen in a different
> color from the words FALSE?
> 
> Thanks.
> 
> --Chris

# install.packages("xterm256")
library(xterm256)

cat(style(x, fg=c(0,0,0,1,0,0,1,1,0)))

HIH

Paolo




More information about the R-help mailing list