1

I have two data frames that differ only on the last column. I am trying to rbind them into one data frame while at the same time keeping their respective last column distinct from each other in the final data set. For example:

I have data set A:

ID1     Date       ID2       Sport
1     1/1/2020      A        Soccer
1     1/1/2020      A        Basketball
4     3/11/2020     B        Soccer
7     9/12/2010     D        Tennis

And I have a similar data set B

ID1     Date       ID2       Food
1      1/1/2020      D        Hamburger
9      2/2/2000      A        Chicken
42     3/11/2024     B        Lettuce
17     9/12/2010     D        Orange Juice

And I want to combine them into something that looks like this:

ID1     Date        ID2       Sport        Food
1     1/1/2020       A        Soccer       Null
1     1/1/2020       A        Basketball   Null
4     3/11/2020      B        Soccer       Null
7     9/12/2010      D        Tennis       Null
1      1/1/2020      D        Null         Hamburger
9      2/2/2000      A        Null         Chicken
42     3/11/2024     B        Null         Lettuce
17     9/12/2010     D        Null         Orange Juice


How can I accomplish this?

Alokin
  • 461
  • 1
  • 4
  • 22

0 Answers0