removeMethods(f, where) removeGeneric(f, where)
removeMethods returns the default method for
f, if it was defined on this database.
removeGeneric returns nothing useful.
removeMethods removes the generic function named
f and all its methods from database
where; that is, removes the object from the meta-database for
where
containing all the methods for
f on that database.
If no such methods exist, it warns.
If a function object named
f exists on
where,
it will be removed if it is a standard generic function (as would be created when
methods were first assigned for
f).
removeMethods("f") will define a an ordinary function
f()
to be the default method of the generic function
f(), if it had a default
method.
removeGeneric("f") does all that
removeMethods does except
it will not define the ordinary function
f() (nor return the old default
method).
## remove foo and reset it to the default method
foo <- function(x)"original non-generic foo"
setGeneric("foo", function(x)standardGeneric("foo"))
setMethod("foo", "integer", function(x)"integer method for foo")
foo(as.integer(1))
## [1] "integer method for foo"
removeMethods("foo")
foo(as.integer(1))
## [1] "original non-generic foo"