using R 2.3 of 1/31/06 > new("list") list() > new("list", list(a=1)) $a [1] 1
> setClass("listlike", contains="list") [1] "listlike" > new("listlike", list(a=1)) An object of class "listlike" [[1]] [1] 1 Why does the list in the second construction lose the element name? A workaround is to endow the listlike class with a names slot, but it would be nice for the names to be propagated from the data to the object. Loss of names in a numeric construction does not require extension: > new("numeric", c(a=1)) [1] 1 But coercion can allow names to persist. > as(c(a=1), "numeric") a 1 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel