title: How to Interleave the items of a vector to replace NAs with preceding values in R
body: <p>I have this vector <code>myvec</code>. I want to remove all the NAs and replace them with the preceding items and get the result.</p>
  
  <p>myvec</p>
  
  <pre><code>c("AMLM12001KP", NA, "1114002", NA, "1121501", NA, "1231401", 
  NA, NA, NA)
  </code></pre>
  
  <p>result</p>
  
  <pre><code>AMLM12001KP  AMLM12001KP  1114002  1114002  1121501  1121501  1231401 
  1231401  1231401  1231401
  </code></pre>