[Rd] Overriding S4 methods in an installed package

Allen McIntosh mcintosh at research.telcordia.com
Sun Aug 19 03:12:32 CEST 2007


Duncan Murdoch wrote:
> I think you can set the environment of your method to see the package 
> internals.  Those internals won't see your method, though.
> 
> To do this, you'd do something like
> 
> newfoo <- function(obj , x, y) { new definition }
> environment(newfoo) <- environment(foo) # or some other function from 
> the package
> 
> setMethod("foo", signature(obj = "bar"),
>        newfoo)

That did it.  Thank you.



More information about the R-devel mailing list