Let's say I have two data tables (dt1 and dt2), and I want to get dt3 using data tables. A,B,C,E,F,G,H are column names. dt1 key is column A, and dt2 key is column E. Data tables have different number of rows. I want to keep all the columns from DT1, and add only one column (H) from DT2 to the joined data table. Eventually, I will store this as DT1 (though I showed it as dt3 below).
How can I achieve it with data tables? I have an ugly solution with merge + data frames.
dt1
A B C
1 4 7
2 5 8
3 6 9
2 20 21
dt2
E F G H
1 10 13 16
3 12 15 18
2 11 14 17
dt3
A B C H
1 4 7 16
2 5 8 17
3 6 9 18
2 20 21 17