I have two data frames, link and body:
link is like this:
wpt        ID
1          1235
mediate    4562
mediate    0928
2          6351
3          3826
mediate    0835
body is like this:
wpt   fuel    distance
1     2221    53927
2     4821    48261
3     8362    47151
The output i expected is like this:
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
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?
Thanks in advance!
 
     
     
     
     
    