[R] findGlobals on apply
Christophe Genolini
cgenolin at u-paris10.fr
Tue Apr 8 07:18:43 CEST 2008
> > 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
More information about the R-help
mailing list