0

Suppose I have two datasets.

id age disease1
a1   1        1
a2   2        1
b1   3        0
b2   4        1

And

id age disease2
a1   1        1
a2   2        1
a3   5        1
b1   3        0
b2   4        1

I would like to combine the information in the two datasets and make a new one that looks like:

id age      disease1 disease2
a1   1             1        1
a2   2             1        1
a3   5          <NA>        1
b1   3             0        0
b2   4             1        1

The tricky part is that the two datasets have different information on the same subjects, but dataset2 has more rows. I have tried using cbind() etc, but it didn't work.

Chubing
  • 187
  • 1
  • 3
  • 10

0 Answers0