Skip to content
Prev 7530 / 12125 Next

[R-pkg-devel] S4 Methods and Ellipsis Formals

Good day,

I read in the documentation of SetMethod that "Roughly, if the generic has ... as one of its arguments, then the method may have extra formal arguments, which will be matched from the arguments matching ... in the call to f." I was hoping that ellipsis could be also part of a method because this explanation doesn't explicitly rule it out. What I am hoping to do is:

setGeneric("Example", function(x, ...) standardGeneric("Example"))
setMethod("Example", "numeric", function(x, y, ...) as.list(...))
Example(x = 1, y = 2, z = 3, a = 99) # Error in typeof(x) : argument "x" is missing, with no default

So, ellipsis can't be a formal of a method, but only in the generic? May this be clarified by the documentation?

--------------------------------------
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia