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