Displaying 1 result from an estimated 1 matches for "725868".
Did you mean:
125868
2010 May 26
3
Indexing bug?
Is this expected behaviour?
x <- factor(c("c", "b", "a","c"))
results <- c(c=4, b=5)
results[x]
giving
> results[x]
<NA> b c <NA>
NA 5 4 NA
(i.e. it appears to give results[levels(x)]
whereas results[as.character(x)] does what I expected:
as.character(x)
results[as.character(x)]
> as.character(x)
[1]