Hi all,
I'm working with the S4-Class system and I have a little problem with
Implementing iteration functionality in my S4 class but it don't work:
> setClass("foo",representation(bar="list"))
> x <- new("foo",bar=list(1,2,3))
>for(e in x) cat(e)
invalid type/length (S4/1) in vector allocation
But when I extend from a primitive vector it works:
> setClass("foo",contains="list")
> x <- new("foo",.Data=list(1,2,3))
>for(e in x) cat(e)
123
This is ok, but is there any other way to do this (for e.g. with a
generic function)?
Thanks,
Rudolf
[[alternative HTML version deleted]]
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel