[R] callNextMethod with dots argument
Kiên Kiêu
kien.kieu at jouy.inra.fr
Thu Sep 19 08:58:23 CEST 2013
Hi,
I met a problem when invoking callNextMethod within a method associated
with a generic function taking ... as an argument.
Here is the code
setClass("Aparent",representation(x="numeric",y="numeric"))
setClass("Achild",contains="Aparent")
setGeneric("do",def=function(a,...) standardGeneric("do"))
setMethod("do",signature(a="Aparent"),
function(a,msg) {
print("do Aparent")
})
setMethod("do",signature(a="Achild"),
function(a,msg) {
print("do Achild")
callNextMethod()
})
myA <- new("Achild")
buf <- do(a=myA) # works
buf <- do(a=myA,msg="bonjour") # error
The last call yields the following error message:
Error in callNextMethod() :
in processing 'callNextMethod', found a '...' in the matched call,
but no corresponding '...' argument
which I do not understand. Replacing "..." by "msg" in setGeneric makes
it work. But I don't like this limitation so much (unless I understand it).
Regards.
Kien
More information about the R-help
mailing list