title: How to merge two datasets with different information on same subjects in R?
body: <p>Suppose I have two datasets.</p>
  
  <pre><code>id age disease1
  a1   1        1
  a2   2        1
  b1   3        0
  b2   4        1
  </code></pre>
  
  <p>And </p>
  
  <pre><code>id age disease2
  a1   1        1
  a2   2        1
  a3   5        1
  b1   3        0
  b2   4        1
  </code></pre>
  
  <p>I would like to combine the information in the two datasets and make a new one that looks like: </p>
  
  <pre><code>id age      disease1 disease2
  a1   1             1        1
  a2   2             1        1
  a3   5          &lt;NA&gt;        1
  b1   3             0        0
  b2   4             1        1
  </code></pre>
  
  <p>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.</p>