Here I am having problem to define a subclass, specially if I define that subclass after defining initialize() method for its superclass. Here is my code:
> setClass("a", representation=list(x="numeric", y="numeric"), > prototype=list(x=rnorm(10), y=rnorm(10))) [1] "a" > setMethod("initialize", "a", function(.Object, x, y, ...) { + if (length(x) != length(y)) x = y = rep(5, 4) + .obj...@x = x + .obj...@y = y + .Object }) [1] "initialize" > setClass("b", representation=list(x1="character"), contains="a") Error in .local(.Object, ...) : element 1 is empty; the part of the args list of 'length' being evaluated was: (x) > Can anyone please point me where I am doing wrong? Thanks, ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.