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

2012-06-27 Thread nikola
that's an old thread but checkout the colorout package - it is awesome and it
does exactly what you're asking for !
http://cran.r-project.org/web/packages/colorout/ 

--
View this message in context: 
http://r.789695.n4.nabble.com/colour-highlighting-inputs-and-outputs-in-the-R-terminal-tp1565865p4634653.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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

2010-02-24 Thread Romain Francois

On 02/23/2010 03:02 PM, Marc Schwartz wrote:


On Feb 23, 2010, at 7:05 AM, Liviu Andronic wrote:


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.  MedianMean 3rd Qu.Max.  ##in blue
  1   2   3   3   4   5  ##in blue

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


Hi Liviu,

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.


That's right, xterm256 is for manual formatting.

What Liviu wants is not impossible to achieve --- it has been done for 
python for example [1] --- but would require some considerable effort, 
using for example ncurses [2] .


Romain

[1] http://bpython-interpreter.org/home/
[2] http://www.gnu.org/software/ncurses/


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.

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



--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/OIXN : raster images and RImageJ
|- http://tr.im/OcQe : Rcpp 0.7.7
`- http://tr.im/O1wO : highlight 0.1-5

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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

2010-02-23 Thread Hrishi Mittal

Liviu, if you use Emacs + ESS, that provides colour highlighting. You can
also have a script file alongside so that you have a saved command history
in an R source file.

See http://ess.r-project.org/ to get started.

-
Try  http://prettygraph.com Pretty Graph , the easiest way to make R-powered
graphs on the web.
-- 
View this message in context: 
http://n4.nabble.com/colour-highlighting-inputs-and-outputs-in-the-R-terminal-tp1565865p1565909.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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

2010-02-23 Thread Liviu Andronic
Hello

On 2/23/10, Marc Schwartz marc_schwa...@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
Liviu


  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?
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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.