Skip to content
Prev 19376 / 63424 Next

extending "list" in S4: loss of element names

using R 2.3 of 1/31/06
list()
$a
[1] 1
[1] "listlike"
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:
[1] 1

But coercion can allow names to persist.
a
1