Hi,

I have a vector A with (200, 201, 202, 203, 204, ... 210) and a vector B
with (201, 204, 209).
Now I would like to get the position in vector A matches with the entries in
vector B
So what I want to have is the following result:
[1] 2 5 10

I tried the following:
grep(B, A)

grep(c(B), A)

A <- as.character(A)
B <- as.character(B)

grep(B, A)
grep(c(B), A)

and several other combinations. But nothing is giving me the right result?!
Does anyone know why?

Cheers,
Mentor
-- 
View this message in context: 
http://www.nabble.com/Using-grep-tp19881017p19881017.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to