Skip to content
Prev 25916 / 63424 Next

Overriding S4 methods in an installed package

Allen McIntosh 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)
This is getting easier:  we're down to a single install, as long as you 
don't need all possible formats of man pages.

Duncan Murdoch