我想弄清楚为什么下面的代码会引发错误:
Error in .local(.Object, ...) : argument "data" is missing, with no default
问题代码:
setClass("A", representation(a="numeric"), "VIRTUAL")
setClass("B", representation(b="numeric"), contains="A")
setMethod("initialize", "A", function(.Object, data){
.Object@a <- data[1]
})
setMethod("initialize", "B", function(.Object, data){
.Object@b <- data[2]
callNextMethod()
})
data <- 1:2
new("B", data)
谢谢您的帮助!