title: Forward and backward fill data frame in R
body: <p>I have a data frame in with data as follows</p>
  
  <pre><code>Col1    Col2 
  20      NA    
  25      NA     
  15      NA
  NA      10
  NA      15
  </code></pre>
  
  <p>and so on... I am looking to reshape it as follows</p>
  
  <pre><code>Col1     Col2
  20        10
  25        10
  15        10
  15        10
  15        15
  </code></pre>
  
  <p>Basically to forward or backward fill NA values with the first occurring non NA value. I tried a variation of <a href="https://stackoverflow.com/questions/40479001/carry-last-factor-observation-forward-and-backward-in-group-of-rows-in-r">Carry last Factor observation forward and backward in group of rows in R</a>, but was unable to get it to work...
  Thanks in advance!</p>