Is it possible to override S4 methods in an installed package?
The naive
library("pkg")
setMethod("foo", signature(obj = "bar"),
function(obj , x, y) { new definition }
, where="package:pkg")
results in the error
Error in setMethod("foo", signature(obj = "bar"), function(obj, :
the environment "pkg" is locked; cannot assign methods for function
"foo"
(This is from R 2.5.1 on Fedora Core 5, if that matters)
Background: A colleague claims to have found an error in a package.
He and I would prefer to do some experimentation before contacting
the authors. Subclassing is the "correct" way to do this, and I
expect we will eventually subclass for other reasons, but I was
wondering if an override was possible and easier.
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel