R S4 initialize and callNextMethod() -


i trying figure out, why code below throws error:

error in .local(.object, ...) : argument "data" missing, no default 

problem code:

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) 

thank help!

maybe looking for?

setclass("a", representation(a="numeric"), "virtual") setclass("b", representation(b="numeric"), contains="a")  setmethod("initialize", "a", function(.object, data){   .object@a <- data[1]   .object })  setmethod("initialize", "b", function(.object, data){   .object@b <- data[2]   .object <- callnextmethod(.object, data)   .object })  data <- 1:2  new("b", data) 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -