[R] Removing or ignoring package version for generic function in locked environment

Oliver Mannion (COMPASS) o.mannion at auckland.ac.nz
Wed Nov 2 01:31:14 CET 2011


Hi,

I use the epicalc package which provides the function aggregate.numeric.

Unfortunately aggregate.numeric produces warnings when aggregate is used by functions not under my control on a numeric value. If I don't load epicalc, aggregate.default is used instead by these functions and does not produce any warning.

However I need epicalc. So to get around this, what I would do is firstly remove aggregate.numeric:

rm(aggregate.numeric, pos=which(search() == "package:epicalc"))

This worked fine in R 2.13.1. However in R 2.14.0 I am getting the following:

Error in rm(aggregate.numeric, pos = which(search() == "package:epicalc")) : 
  cannot remove bindings from a locked environment

Is there some way I can remove aggregate.numeric, or otherwise prevent it from being used?

Thanks in advance,

Oliver



More information about the R-help mailing list