I have a toy data-frame.
a = rep(1:5, each=3) b = rep(c(\"a\",\"b\",\"c\"), each = 5) df = data.frame(a,b) a b 1 1 a 2 1 a 3 1 a 4 2 a 5 2 a 6 2 b
Use the %in% argument
%in%
df[df$a %in% idx,]