1

What is the easiest way to combine two separate data.frames when one data.frame contains more rows than the other? Here is what I have:

Dataframe A
Customer ID      Items sold         Price
1                 20                 2.50
2                 30                 10.00
3                 40                 15.00
4                 NA                 1.00
5                 NA                 1.00

Dataframe B
customer Id       Items bought
1                  10
2                  NA 
3                  3
nrussell
  • 18,382
  • 4
  • 47
  • 60

1 Answers1

2

You can try merge

merge(A, B, by.x='Customer.ID', by.y='customer.Id', all=TRUE)
akrun
  • 874,273
  • 37
  • 540
  • 662