[R] Output args?
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Fri Jun 9 07:15:52 CEST 2000
On Thu, 8 Jun 2000, Yves Gauvreau wrote (after adding some line breaks):
> Is there a way to find out if a function was called with an
> output argument? Or to prevent the printing of large amount of data if
> the function was called without output argument?
and later:
> I forgot to ask if it was possible when there is no output argument to
> somehow "put" the data in the global environnement?
I think you misunderstand. S is a functional language, so *all* functions
return something (possible NULL). And if an object is evaluated at the
top-level and is not part of an assignment, its result is *printed* unless
the auto-print flag is false. If you don't want to see the result, either
enclose the call in invisible() or assign the result to an R object, as in
> 2+3
[1] 5
> invisible(2+3)
> z <- 2+3
>
(BTW, "+" really is a function in S, and I could have written "+"(2,3)
to show this.)
I hope I have guessed correctly what you had in mind.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list