Re: [R] match values from data.frame and vector

2012-04-15 Thread peter dalgaard
On Apr 15, 2012, at 09:36 , Omphalodes Verna wrote: > Dear R helpers! > > I have a vector 'x1' and data.frame 'df1'. Do you have any suggestion how to > get vector x2, which will be a result of matching values from vector 'x1' and > values from 'df1'? Please, see the example: > > x1 <- c(rep(

[R] match values from data.frame and vector

2012-04-15 Thread Omphalodes Verna
Dear R helpers! I have a vector 'x1' and data.frame 'df1'. Do you have any suggestion how to get vector x2, which will be a result of matching values from vector 'x1' and values from 'df1'? Please, see the example: x1 <- c(rep(1,3), rep(NA,2), rep(2,4)) df1 <- data.frame(c1 = c(1,2), c2 = c(5,6