Imagine a dataset like this
Dataset
Var1 Var2
a apple
b banana
c table
d apple
e banana
f table
g banana
I have a vector like this
x<-c("apple","banana")
I want to subset the dataset and obtain a dataset that only has elements which Var2 is equal to ONE of the elements of x.
so that the output should be a dataset like
Var1 Var2
a apple
b banana
d apple
e banana
g banana
I know the question might seem trivial, but I can't find an answer on the web.