Ned wrote:

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.

d[1] returns a list of length 1, while d[[1]] returns only the element.

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.

names(B)[2]

Uwe Ligges

BTW: If all list elements are character of length 1, why are you not using a character vector instead?




cheers,

Ned

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to