Hi,

I have a string vector, say,
x <- "a", "aab"
and anther string vector, say,
y <- "a", "aa", "aab", "aabc".

Is there any R function to get the indices of y for the elements of x, that
is, foo(x, y) will give me the index vector c(1, 3)?

I know i can combine apply() and grep("^aab$", y) to do it. But is there any
elegant R function I can use?

Thanks,

-Luke

        [[alternative HTML version deleted]]

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

Reply via email to