HELP! How to determine missing data from a merged data set?

Hello!

I'm merging two excel sheets with sample data. Both sheets have a common column that I will be merging the data by (ex: student name). The problem I have is one of my sheets has 100 names whereas the other has 105 names. How can I determine what the extra 5 names are?

When I try to merge the two sheets together in R, I get this error message:

Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 105, 100

I figured how to merge the 100 names and all of their data; however, I need to identify who was not included in the merge.

Please help!

You can use the anti-join function from dplyr.

library(dplyr)
DF1 <- data.frame(Name = c("B", "C", "A", "E", "D"), value = 1:5)
DF1
  Name value
1    B     1
2    C     2
3    A     3
4    E     4
5    D     5
DF2 <- data.frame(Name = c("D", "E", "B", "A"), value = 4:1)
DF2
  Name value
1    D     4
2    E     3
3    B     2
4    A     1
Missing <- anti_join(DF1, DF2, by = "Name")
Missing
  Name value
1    C     2

That worked perfectly! Thank you!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.