Generalize R %in% operator to match tuples
问题 I spent a while the other day looking for a way to check if a row vector is contained in some set of row vectors in R. Basically, I want to generalize the %in% operator to match a tuple instead of each entry in a vector. For example, I want: row.vec = c("A", 3) row.vec # [1] "A" "3" data.set = rbind(c("A",1),c("B",3),c("C",2)) data.set # [,1] [,2] # [1,] "A" "1" # [2,] "B" "3" # [3,] "C" "2" row.vec %tuple.in% data.set # [1] FALSE for my made-up operator %tuple.in% because the row vector c("A