[R] Indexing, and using an empty string as a name
Charilaos Skiadas
cskiadas at gmail.com
Wed Nov 7 05:45:26 CET 2007
Hello all,
I ran into the following, to me unexpected, behavior. I have (for
reasons that don't necessarily pertain to the question at hand, hence
I won't go into them) the need/desire to use an empty string for the
name of a vector entry. Perhaps I did not read ?"[" very carefully,
but it seems to me that he following lines should return "1" at the end:
x<-1:4
names(x) <- c("","a","b","c")
x[""]
Instead, they return NA. Could anyone provide an explanation for this
behavior?
Thanks,
Haris Skiadas
Department of Mathematics and Computer Science
Hanover College
More information about the R-help
mailing list