select missing rows in different dataframes

This is database join operation. If you search for joins you will find more information on the different kinds out there. As @starja said, you want the anti_join from dplyr:

Install dplyr if you don’t have it already with install.packages('dplyr')

R> list1 <- data.frame(a=0:5, b=10:15)
R> list2 <- data.frame(a=(0:5)+3, b=(10:15)+3)
R> list1
  a  b
1 0 10
2 1 11
3 2 12
4 3 13
5 4 14
6 5 15
R> list2
  a  b
1 3 13
2 4 14
3 5 15
4 6 16
5 7 17
6 8 18
R> list3 <- dplyr::anti_join(list1, list2)
Joining, by = c("a", "b")
R> list3
  a  b
1 0 10
2 1 11
3 2 12
R> 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top