[R] Output args?

Yves Gauvreau cyg at sympatico.ca
Fri Jun 9 13:05:42 CEST 2000


Thanks for the prompt response.

I know nothing about S and about the fact that it is a functional language.
I don't know much about English, functional languages, stats and maths
either I'm just a retired high school teacher fiddling around to pass the
time. But I know that when someone doesn't know something it only means that
this someone doesn't know this subject and it certainly doesn't mean that
this someone is necessarily stupid.

I find out by trial and error later that you can do the following.

foo<-function(x,y,z){
  ...
  abc<-list(a=x,b=y,c=z)
}

and call

foo(1,2,3)

there is nothing outputted to the console which is close to what I ask in
the first part of my query. I'll continue investigating to learn if it's
possible to export or whatever is the right term, the variables I want so
that there available for future use at the top level.

Regards

Yves Gauvreau



----- Original Message -----
From: "Prof Brian D Ripley" <ripley at stats.ox.ac.uk>
To: "Yves Gauvreau" <cyg at sympatico.ca>
Cc: <r-help at stat.math.ethz.ch>
Sent: Friday, June 09, 2000 1:15 AM
Subject: Re: [R] Output args?


> 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
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
>

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