Remove all the Methods for a Function

USAGE:

removeMethods(f, where)
removeGeneric(f, where)

ARGUMENTS:

f
the character string name of the generic function.
where
the attached database from which to remove the methods; of course, you need to have write permission on this database.

VALUE:

removeMethods returns the default method for f, if it was defined on this database. removeGeneric returns nothing useful.

Side Effects:

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).

SEE ALSO:

to remove a single method; to save the methods before removing them; to see all the methods for a function and where they are; to see all versions of a particular method.

EXAMPLES:

## 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"