[R] no implicit call of the print function within loops?

Mark Heckmann mark.heckmann at gmx.de
Tue Dec 9 18:44:21 CET 2008


Dear R-users,

I wonder why some functions produce output when they are called (I suppose
due to an implicit call of the print function) but within a loop they do
not:

attach(anscomce)
exp <- parse(text= "lm(x1 ~ y1)")
eval(exp)

Here the print() function seems to be called implicitly.
If I do the same within a for-loop, it is not.

for (i in c(1)){
   eval(exp)
}

I know that I have to wrap it into a print function so it would work. 
But why is that so? In the eval() help I don't find any clues. 
As this happens with other functions as well, I would like to understand the
causes and thus
avoid some future mistakes.

TIA,
Mark



More information about the R-help mailing list