1

Could anyone help to explain me this issue. I have 2 dataframes: mail_sent:1901 rows and client_return_race: 1663 rows. I want to merge these dataframes together and all rows in mail_sent should be show.

These 2 dataframes have 3 same column: CLIENT_ID, CAMPAIGN_NAME, TIME. I want to merge 2 dataframes based on 3 same columns above. The below is my code.

The code runs well however, the result of merging (mail_race) is 1663 not 1901. I expect it should show 1901 rows because I mentioned all.mail_sent=all/ all.mail_sent=TRUE in the code. It seems that the merge is inner join not outer join.

  mail_race<-merge(mail_sent,client_return_race,by.mail_sent=c("CLIENT_ID","CAMPAIGN_NAME","TIME"),
             by.client_return_race=c("CLIENT_ID","CAMPAIGN_NAME","TIME")
             ,all.mail_sent=TRUE)
Psidom
  • 209,562
  • 33
  • 339
  • 356
Celine
  • 45
  • 2
  • 8

1 Answers1

0
Try this one it may help you

mail_race<-merge(mail_sent,client_return_race,all.x = T ,all.y = T)
Arun kumar mahesh
  • 2,289
  • 2
  • 14
  • 22