[Rd] mysteriously persistent generic definition

Ross Boylan ross at biostat.ucsf.edu
Wed Oct 28 20:14:04 CET 2009


Here's a self-contained example of the problem:

> foo <- function(obj) {return(3);}
> setGeneric("foo")
[1] "foo"
> removeGeneric("foo")
[1] TRUE
> foo <- function(x) {return(4);}
> args(foo)
function (x) 
NULL
> setGeneric("foo")
[1] "foo"
> args(foo)
function (obj) 
NULL

R 2.7.1.  I get the same behavior whether or not I use ESS.

The reason this is more than a theoretical problem:

> setMethod("foo", signature(x="numeric"), function(x) {return(x+4);})
Error in match.call(fun, fcall) : unused argument(s) (x = "numeric")

Ross



More information about the R-devel mailing list