I have two data frames with two columns in each. For instance:
df.1 = data.frame(col.1 = c("a","a","a","a","b","b","b","c","c","d"), col.2 = c("b","c","d","e","c","d","e","d","e","e"))
df.2 = data.frame(col.1 = c("b","b","b","a","a","e"), col.2 = c("a","c","e","c","e","c"))
and I am looking for an efficient way to find the row index in df.2 of each pair of rows col.1 col.2 from df.1. Please note that a pair of lines in df.1 may appear in df.2 in the reverse order (for example, df.1 [1,], which is "a", "b" appears in df.2 [1,] as " b "," a "). It doesn't matter to me. In other words, as long as a pair of lines in df.1 appears in any order in df.2, I want its row index in df.2, otherwise it should return NA. One more note: line pairs in both data frames are unique: each line pair appears only once.
So, for these two data frames, the returned vector will be:
c(1,4,NA,5,2,NA,3,NA,6,NA)