In R: How can I insert a small data frame into a bigger one and simultaneously add new rows if necessary? The data frames should normally be merged by ID1, ID2 and ID3. But the bigger data frame got all row names of the smaller one.
Main data frame to be inserted in (NAs are left blank):
ID1 ID2 ID3 r1 r2 r3 r4 r5 r6
A 1 a d1
A 1 b d2
A 2 a d3
Small data frame:
ID1 ID2 ID3 r5
A 1 a d4
A 1 b d5
A 2 a d6
A 2 b d7
Desired output:
ID1 ID2 ID3 r1 r2 r3 r4 r5 r6
A 1 a d1 d4
A 1 b d2 d5
A 2 a d3 d6
A 2 b d7