0

I am trying to merge to datatables while combining the values of two columns.

Example:

Datatable X:

enter image description here

Datatable Y1:

enter image description here

So, when I merge X with Y1 by ID and Brand and keeping all values of X. I get datatable Z:

enter image description here

However, after this, I got datatable Y2:

enter image description here

An I would like to get this datatable when I merge it with Z:

enter image description here

Hopefully, that was clear. Thanks for your help.

  • Posting data as images really makes me cry. Please take a look at [how to make a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Martin Gal Jun 25 '20 at 17:00

1 Answers1

0

This is a common problem. First, vertically combine Y1..YN like this:

Yall = rbindlist(list(Y1,Y2,...,YN))

Then merge X with Yall.

webb
  • 4,180
  • 1
  • 17
  • 26