[R] how R outputs?

Liaw, Andy andy_liaw at merck.com
Thu Dec 16 14:46:36 CET 2004


If R is run in interactive mode; i.e., interactive() == TRUE, whatever
function calls that produced R objects gets printed (by calling the
appropriate print() method; known as auto-printing), unless the object is
returned invisibly (i.e., wrapped in invisible()).  As an example, if you
put

abs(-3)

into a file, then run that through R CMD BATCH, you will not see the output
printed.  Also, auto-printing is off inside loops; e.g.,

for (I in 1:10) abs(-3)

will not show any output, even if you run it in an interactive session.

Andy

> From: xudongyuan
> 
> Hi.All and R developers:
> 	When I look into the R source code, I have a 
> question.Since R has its own data structure(i.e. SEXP),how 
> does it convert the result to the normal output after it has 
> computed? For example,when I input,
> >abs(-3)
> I learned that in R's execution, the expression is parsed to 
> a parse tree,and becomes a SEXP list. After "eval" function, 
> the result is still a SEXP. But R outputs:
> [1] 3
> The output is normal.So my question is how R makes its SEXP 
> result into the normal result.Where can I find the place R 
> makes this convertion in R's source code?Can anyone help me?
> 		thanks
> 								
> 								
> dongyuan xu
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>




More information about the R-help mailing list