Can I associate an index to a vector that is maintained and that I can retrieve by a second vector?
V1<-c("a", "b", "c", "d", "e", "f")
I want to associate an index something similar to:
"a" "b" "c" "d" "e" "f"
1 2 3 4 5 6
Then by a second vector
V2<-c("b", "c", "f")
I should get integers 2, 3, 6
I know I can create a data frame with two columns ID=V1 and ixd= 1:length(V1)
and subset by V2
I am wondering if there is a faster way