Re: [Rd] Missing args with a default value in S4 methods

2007-06-17 Thread John Chambers
Where the generic and the method have different arguments, there is a local version of the method that must be called, with argument matching. In your call, R's behavior is to pass down the missing argument from the generic. (Your explicit empty argument is intrinsically different in R from m

Re: [Rd] Missing args with a default value in S4 methods

2007-06-15 Thread Herve Pages
John Chambers wrote: > This has essentially nothing to do with methods, but rather with the > treatment of missing arguments. > > Consider: >> foo <- function(x,...)bar(x,...) >> bar <- function(x, y=12, z, ...) {cat(missing(y), "\n"); cat(y, "\n")} > > This is the same argument-matching as your

Re: [Rd] Missing args with a default value in S4 methods

2007-06-15 Thread John Chambers
This has essentially nothing to do with methods, but rather with the treatment of missing arguments. Consider: > foo <- function(x,...)bar(x,...) > bar <- function(x, y=12, z, ...) {cat(missing(y), "\n"); cat(y, "\n")} This is the same argument-matching as your example, since the generic and

[Rd] Missing args with a default value in S4 methods

2007-06-14 Thread Herve Pages
Hi, Strange things happen with missing args in S4 methods: > setGeneric("mygen", signature="x", function(x, ...) standardGeneric("mygen")) [1] "mygen" > setMethod("mygen", "character", function(x, y=12, z, ...) {cat(missing(y), "\n"); cat(y, "\n")}) [1] "mygen" > mygen("aa", z=99)