Re: [R] findGlobals on apply

From: Christophe Genolini <cgenolin_at_u-paris10.fr>
Date: Tue, 08 Apr 2008 07:18:43 +0200

> > f <- function(x){apply(x,2,mean)}
> > findGlobals(f)
> mean is a global variable, so findGlobals gets it right.
That sound strange to me: a "variable" is something that vary... mean does not vary. maen will ge an argument that is a line of x and will make some calculous on it, that is the comportement of a function. Of course, mean is an argument of an other function, but I do not think this is a reason good enouth to say that mean is a variable.

Furthemore, I use findGlobals to detect some typo. In

f <- function(myObject){return(mObject^2)}

findGlobals will detect that mObject is a global so I know there is a typo somewhere.
Considering mean as a globals do not let us use findGlobals this way.

Christophe



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 08 Apr 2008 - 05:26:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Apr 2008 - 12:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive