[Rd] list element names in S4 class extending list

From: Vincent Carey 525-2265 <stvjc_at_channing.harvard.edu>
Date: Mon, 21 May 2007 13:12:54 -0400 (EDT)


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_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 22 May 2007 - 06:53:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 May 2007 - 19:33:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.