title: Handle subsets of data frames in R
body: <p>I have the following dataset with two columns c1 and c2:</p>
  
  <pre><code>"c1""c2"
  1  NA
  1  NA
  1  NA
  1  Low
  2  NA
  2  NA
  2  High
  3  Low
  3  NA
  3  NA
  3  High
  4  NA
  4  High
  4  NA
  4  Low
  </code></pre>
  
  <p>What I would like to have is, based on the first column presenting different participants (same participant = same number):</p>
  
  <ul>
  <li><p>remove all NAs until the first non-NA </p></li>
  <li><p>after the first non-NA, copy that value to all the subsequent participant lines and overwrite any NA, until the next participant comes up</p></li>
  </ul>
  
  <p>My output here would be:</p>
  
  <pre><code>1 Low
  2 High
  3 Low
  3 Low
  3 Low
  3 Low
  4 High
  4 High
  4 High
  </code></pre>
  
  <p>Does that make sense ? If yes, what could I do without using a for-loop ? Thanks for any help and I'm not sure about a good title for this either.
  Regards !</p>