I'm working on migrating some SAS programs into R, and I'm having a difficult time figuring out the best way to accomplish this seemingly simple bit of logic.
DATA HAVE;
MERGE HAVE1 HAVE2;
BY ID;
RUN;
Example for Match merge is,
HAVE1:
ID A B
10 1 2
20 3 4
30 5 6
HAVE2:
ID C
10 0
30 1
40 1
HAVE:
ID A B C
10 1 2 0
20 3 4 .
30 5 6 1
40 . . 1