[R] function masking and gmp questions
Carl Witthoft
carl at witthoft.com
Tue Jan 4 01:17:50 CET 2011
Hi,
Here's the problem I ran into: the gmp package has a method for apply()
so it masks the base::apply function. With gmp installed, I tried to
run the function turnpoints() from the pastecs package. It fails
because it calls apply() internally, like this:
apply(mymatrix,1,max,na.rm=TRUE)
,
but the code in the gmp package which sets up the operator overload for
apply() strictly limits the arguments to the first three (a matrix, a
dimension, and a function). I get, no surprise:
Rgames> xs<-sin(seq(1,100)/10)
Rgames> turnpoints(xs)
Error in apply(ex, 1, max, na.rm = TRUE) :
unused argument(s) (na.rm = TRUE)
I'm assuming this is a bug in gmp code and will ask the owner of that
package about it.
But in the meantime, is there some way to force a function to search for
functions in a different namespace, or at least to search with packages
set in a different order? That is, in this example, to make
turnpoints() look to package base before looking at gmp?
Thanks for your help and corrections to any of my assumptions and
conclusions here.
Carl
More information about the R-help
mailing list