I have 2 different dataset. one of them (df1) is a subset of another one (df2). there is a group called SAMPN. I want to remove all group elements in larger data set if there is at least one row from that group in smaller data set.
df2
SAMPN PERNO
1 1
1 2
1 3
2 1
2 3
3 3
3 4
3 5
4 1
4 3
df1
SAMPN PERNO
1 1
2 1
2 3
output
SAMPN PERNO
3 3
3 4
3 5
4 1
4 3
data:
df1:
structure(list(SAMPN = c(" 11", " 18", " 27", " 33",
" 33", " 39"), PERNO = structure(c(1L, 1L, 1L, 1L, 2L, 4L
), .Label = c("1", "2", "3", "4", "5", "6", "7", "8"), class = "factor")), row.names = c(NA,
-6L), class = c("tbl_df", "tbl", "data.frame"))
df2:
structure(list(SAMPN = c(10, 10, 10, 11, 11, 11, 11, 12, 12,
12, 12), PERNO = c(2, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2)), row.names = 90:100, class = "data.frame")