simple way to show differences between 2 dataframes

2 dataframes

tibble [4 × 2] (S3: tbl_df/tbl/data.frame)
ID : chr [1:2861] "1" "2" "3" "4" CaseNumber: chr [1:2861] "001" "002" "003" "004"

tibble [4 × 2] (S3: tbl_df/tbl/data.frame)
ID : chr [1:2861] "1" "2" "3" "4" CaseNumber: chr [1:2861] "001" "005" "003" "009"

I just want a simple way of showing the differences ie

ID df1$CaseNumber df2$CaseNumber
2 "002" "004"
4 "005" "009"

Obviously there are thousands of records not just 4

Cheers



library(tidyverse)

a1 <- tribble(~key,~cn,
              1,"001",
              2,"002",
              3,"003",
              4,"004")
a2 <- tribble(~key,~cn,
              1,"001",
              2,"005",
              3,"003",
              4,"009")

full_join(a1,a2,
          by="key") %>% 
          filter(cn.x != cn.y)

{waldo} https://waldo.r-lib.org/

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.