title: fill in missing data for group by unique ID
body: <p>My clinical data structure looks like this:</p>
  <pre><code>patientid &lt;- c(100,100,100,101,101,101,102,102,102,104,104,104)
  group &lt;- c(1,1,NA,2,NA,NA,1,1,1,2,2,NA)
  
  Data&lt;- data.frame(patientid=patientid,group=group)
  </code></pre>
  <p>If there is missing data then the NA should become the same value as the other group value for the same patient id. In other words a patient is always in the same group and the missing data needs to be filled in to reflect that. So it should look like this:</p>
  <pre><code>patientid &lt;- c(100,100,100,101,101,101,102,102,102,104,104,104)
  group &lt;- c(1,1,1,2,2,2,1,1,1,2,2,2)
  
  Data&lt;- data.frame(patientid=patientid,group=group)
  </code></pre>