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

Liviu Andronic landronimirc at gmail.com
Wed Feb 24 00:58:02 CET 2010


On 2/23/10, Marc Schwartz <marc_schwartz at me.com> wrote:
>  I was not aware of Romain's xterm256 package, but from a quick review of the manual, it would appear to not support an automated syntax highlighting capability. One seems to need to explicitly print output to the console using his functions to be able to colorize it.
>  Having used R on Windows, Linux and now OSX over the past 8+ years, I initially used ESS (http://ess.r-project.org/) on Windows and stayed with it on each subsequent platform. The terminal consoles are fine for quick and dirty coding and I will frequently use the terminal on OSX to test code for replying to a post here. But for routine use, I am in ESS, which provides syntax highlighting and so much more.
>  On Windows and OSX, there are GUI interfaces that members of R Core have kindly provided which provide colorized output, but there is no parallel on Linux, other than third party options.
>  Rather than using the terminal, I would recommend that you give serious consideration to using a full blown text editor, many of which already support R syntax highlighting and of course typical text editing features. In the most basic implementation, you can write your code in the editor and copy and paste it to the R console.
>From the feedback on r-help it seems that Emacs + ESS is the tool of
choice for expert users. I have sofar preferred to avoid ESS (for
various reasons) and recently settled for Geany, a more lightweight
solution. I'm quite comfortable with what it offers, among others:
syntax highlighting, an embedded terminal, a binding that sends
current line or selection to the terminal for execution and, a
personal favourite, a Tasks plug-in that helps to keep an overview of
the structure of the document via specific comments. From the features
missing, most I'd like to have some kind of automated syntax
highlighting in the embedded VTE.

Thank you for the ESS description; I'll give it a try one day,  but
not quite not yet. Regards

>  With tighter integration, such as ESS, you can have split windows, with R code in one frame (say the upper half of the application window) and the R console running in an other one (say the lower half), both of which support R syntax highlighting. With a quick few keystrokes, you can submit the entire R code frame to the console or highlight sections of code and just submit that. Beyond that there is a lot other functionality (version control, LaTeX support, etc.) available that makes ESS an extremely efficient environment to use.
>  If you prefer to not use or learn Emacs, there are other editors available such as Vim, Bluefish, Eclipse and many others available for Linux, some of which are listed here:
>   http://www.sciviews.org/_rgui/projects/Editors.html
>  JGR is also available for Linux:
>   http://jgr.markushelbig.org/JGR_on_Linux.html
>  HTH,
>  Marc Schwartz

Do you know how to read?
Do you know how to write?

More information about the R-help mailing list