[Rd] list element names in S4 class extending list
Vincent Carey 525-2265
stvjc at channing.harvard.edu
Mon May 21 19:12:54 CEST 2007
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"
More information about the R-devel
mailing list