我有一个参数列表,想通过do.call调用B(var3 = list(1:3))。但是下面的示例仅调用dispatch“missing”的方法。如何访问调度方法“ANY”?
B.initialize<-function(..., var3=list()){
callSuper(..., var3=as.list(var3))
}
.B<-setRefClass(Class = "B"
,fields = list(var3 = "list")
,methods = list(initialize=B.initialize))
setGeneric("B", function(x, ...) standardGeneric("B"))
setMethod("B", "missing", function(x, ...) {
.B()
})
setMethod("B", "ANY", function(x, ...) {
.Part(var1=x, ...)
})
do.call(B,list(var3=list(1:3)))