can list names attributes be preserved through S4
class containment?  seems to be so but only if the containment
relationship is direct ... see below.

> setClass("c1", contains="list")
[1] "c1"
> l1 = list(a=1, b=2)
> o1 = new("c1", l1)
> names(o1)     # pleasant surprise
[1] "a" "b"
> setClass("c2", contains="c1")
[1] "c2"
> o2 = new("c2", l1)
> names(o2)     # sad
NULL
> sessionInfo()
R version 2.6.0 Under development (unstable) (2007-05-11 r41535)
powerpc-apple-darwin8.9.0

locale:
C

attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
[7] "base"

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to