MergeWithMaster.RdMergeWithMaster combines two dataframes using a single key variable and prints a Match-Report: MASTER keys not in SLAVE, SLAVE keys not in MASTER, and presence of duplicates in MASTER, SLAVE and MASTESLAVE.
MergeWithMaster(MASTER, SLAVE, BY = "PATNO", SUB = NULL, DROP_DOUBLE = c("PATSTUID", "CNO", "PATNO"), REPORT = T)
| MASTER | as 1st dataframe |
|---|---|
| SLAVE | as 2nd dataframe |
| BY | ="PATNO key name both in MASTER and SLAVE |
| SUB | =NULL is the extention the second colname of a doublette gets as ".SUB" |
| DROP_DOUBLE | =c("PATSTUID","CNO","PATNO") redundant colnames to be droped from SLAVE |
| REPORT | = T In general we definitely want a report, but not always. |
a merged dataframe
MergeWithMaster
if (FALSE) { df1 = data.frame(CustomerId=c(1:6),Product=c(rep("Toaster",3),rep("Radio",3))) df2 = data.frame(CustomerId=c(2,4,4,7),State=c(rep("Alabama",3),rep("Ohio",1))) MergeWithMaster(df1,df2,"CustomerId") MergeWithMaster(df1,df2,"CustomerId",REPORT = F) }