[R] obtaining the name of a named list

Ned gned at optusnet.com.au
Sun May 16 15:34:40 CEST 2004


I have a list d, in which the names of each elements are single characters, 
and the actual elements are bit sequences representing those characters. If 
I type d[1], I get the name and the bit sequence. If I type d[[1]], I get 
only the bit sequence.

What I want is some way to be able to get the name of the element, 
preferably by specifying an index into the array.

e.g.

 > d
       A       B           C
"00000" "00001"  "0001"

I want some way of saying "give me the name for element number 2" and it 
should return B.


cheers,

Ned




More information about the R-help mailing list