I have the following dataframe:
sp <- combn(c(\"sp1\",\"sp2\",\"sp3\",\"sp4\"),2) d <- data.frame(t(sp),\"freq\"=sample(0:100,6))
and
You are almost there:
d[d$X1 %in% x1 & d$X2 %in% x2,]