Thomas Lumley wrote:
On Tue, 17 Mar 2009, John Chambers wrote:
It's important though to use the default, one argument, call to
setGeneric(). Otherwise the two functions are not consistent and
can't exist in the same namespace.
Thanks. Does this include restricting which arguments are used for
dispatch? I have
setGeneric("bigglm", signature=c("formula","data"))
to dispatch just on the first two arguments.
That seems not to disturb anything. (It's really only the arguments
affecting the default that would break things directly. The other
non-defaults are a problem if multiple packages turn the same S3
function into a generic in inconsistent ways. But here you own both the
S3 and S4 versions.)
(R2.8.1)> foo <- function(x,y,z)UseMethod("foo")
(R2.8.1)> setGeneric("foo", signature = c("x", "y"))
[1] "foo"
(R2.8.1)> getMethod(foo) # the default
Method Definition (Class “derivedDefaultMethod”):
function (x, y, z)
UseMethod("foo")
Signatures:
target
defined
(R2.8.1)> f...@signature
[1] "x" "y"
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel