[R] conditional coloring of output text in console or in GUI
Jim Lemon
jim at bitwrit.com.au
Wed Jul 1 13:19:19 CEST 2009
Christopher W. Ryan wrote:
> 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?
>
>
tfsample<-as.logical(sample(c(0:1),10,TRUE))
plot(1:10,type="n")
text(1:10,1:10,tfsample,col=ifelse(tfsample,"red","blue"))
Jim
More information about the R-help
mailing list