I want to compare two frames of data in parts. Here is an example of my data frames:
a1 <- data.frame(a = 1:5, b=letters[1:5])
a2 <- data.frame(a = c(1,6,3,4), b=letters[1:4])
I would like to write a function that finds two consecutive rows in a1, which also exists in a2 data frame (both columns must match) and save it in a new frame.
Any help would be appreciated.
source
share