[R] Display/show the evaluation result of R commands automatically

Duncan Murdoch murdoch.duncan at gmail.com
Mon Aug 1 01:36:10 CEST 2011


On 11-07-31 7:15 AM, Anthony Ching Ho Ng wrote:
> Hello R-help,
>
> I wonder if it is possible to configure R, so that it will
> display/show the evaluation result of the R commands automatically
> (similar to the behavior of Matlab)

It's open source so in theory anything is possible, but there's no 
built-in support for that.

> i.e. If I type x<- 8
>
> it will print 8 in the command prompt, instead of having type x
> explicitly to show the result and perhaps put an ";" at the end to
> suppress the output.
>
> i.e. x<- 8;

If you wrap the assignment in parens the result is made visible, e.g.

(x <- 8)

will print if you enter it in the console.  (It won't print if it's a 
line in a function; there you need an explicit call to print().  Only 
the value returned at the top level is eligible for auto-printing.)

Duncan Murdoch



More information about the R-help mailing list