Title: | Compare Two Dataframes and Return Adds, Changes, and Deletes |
---|---|
Description: | Compares two dataframes with a common key and returns the delta records. The package will return three dataframes that contain the added, changed, and deleted records. |
Authors: | Shawn Waldroff [aut,cre] |
Maintainer: | Shawn Waldroff <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2024-11-04 05:18:59 UTC |
Source: | https://github.com/swaldroff/dfcompare |
Return dataframes for added, changed, and deleted records
dfCompare(dfOld,dfNew,key)
dfCompare(dfOld,dfNew,key)
dfOld |
Original dataframe |
dfNew |
New dataframe |
key |
Key used to join the dataframes |
a <- c(2, 3, 5) b <- c("aa", "bb", "cc") c <- c(TRUE, FALSE, TRUE) dfOld <- data.frame(a,b,c) a <- c(3,4,5) b <- c("aaa","dd","cc") c <- c(TRUE, FALSE, TRUE) dfNew <- data.frame(a,b,c) dfDelta <- dfCompare(dfOld,dfNew,"a")
a <- c(2, 3, 5) b <- c("aa", "bb", "cc") c <- c(TRUE, FALSE, TRUE) dfOld <- data.frame(a,b,c) a <- c(3,4,5) b <- c("aaa","dd","cc") c <- c(TRUE, FALSE, TRUE) dfNew <- data.frame(a,b,c) dfDelta <- dfCompare(dfOld,dfNew,"a")