using base R:
split(df2,df2[,1])[by(df2[2],df2[1],function(x)all(x==df1))] $`1` setID col1 1 1 apples 2 1 oranges 3 1 apples 4 1 banana
using base R:
split(df2,df2[,1])[by(df2[2],df2[1],function(x)all(x==df1))] $`1` setID col1 1 1 apples 2 1 oranges 3 1 apples 4 1 banana