[R] colour highlighting inputs and outputs in the R terminal?

Liviu Andronic landronimirc at gmail.com
Tue Feb 23 14:05:47 CET 2010


Dear all
Is it possible to get basic colour highlighting for inputs and outputs
in the R terminal? I am looking for something similar to what GUIs
provide, such as JGR and (I think) the Windows R GUI: colouring all
inputs in red, and all outputs in blue. All this in a colour-aware
console (in my case, on Linux).

I've been looking into xterm256 and highlight, but I am sofar unable
to do with them what I would need. The closest I get to is with
style() in xterm256:
> require(xterm256)
> cat( style( "hello world", bg = "black", fg = "blue"), "\n" )
hello world

The text will appear blue. What I would want to achieve, however, is
to be able to define some global options for input fg and bg colours,
and output fg and bg colours. Then, for any command that I would
execute, say `mean(1:5)', I would get:
> mean(1:10)  ##in red
[1] 5.5  ##in blue
> summary(1:5)  ##in red
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.  ##in blue
      1       2       3       3       4       5  ##in blue

Does anyone know a way to do this? Thank you
Liviu


-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail



More information about the R-help mailing list