title: Combine two data frames with different number of rows in R
body: <p>I have two data frames, link and body:</p>
  
  <p>link is like this:</p>
  
  <pre><code>wpt        ID
  1          1235
  mediate    4562
  mediate    0928
  2          6351
  3          3826
  mediate    0835
  </code></pre>
  
  <p>body is like this:</p>
  
  <pre><code>wpt   fuel    distance
  1     2221    53927
  2     4821    48261
  3     8362    47151
  </code></pre>
  
  <p>The output i expected is like this:</p>
  
  <pre><code>wpt      fuel   distance   ID
  1        2221   53927      1235
  mediate  NA     NA         4562
  mediate  NA     NA         0928
  2        4821   48261      6351
  3        8362   47151      3826
  mediate  NA     NA         0835
  </code></pre>
  
  <p>I tried using "merge" function, did not work out. Suppose using row number of "mediate" as index to split "body" and rbind them piece by piece might work. Is there a better nice way? See someone could help here? </p>
  
  <p>Thanks in advance!</p>