Reputation: 1701
I need to take subsets from a list of documents based on a random sample. I know there are a lot of questions about matching on stackoverflow, but I didn't see one that addressed my question.
To demonstrate what I am looking for, suppose we have two vectors:
> A <- c(1,2,4,5,8,9)
> B <- c(1,3,2,2,3,4,5,6,7,7,8,9,10)
The function I need is similar to doing
> 1 == B
> [1] T F F F F F F F F F F F F
That is, I need a function f
such that
> f(A,B)
> [1] T F T T F T T F F F T T F
Any ideas? match(B,A)
returns something similar to what I'm looking for, but not quite.
Upvotes: 4
Views: 1846