title: Padding column values?
body: <p>In R 2.14.2 I have a matrix:</p>
  
  <pre><code>mat1=matrix(c('A','','','B'))
  </code></pre>
  
  <p>and I want to fill in the empty values so it becomes like this:</p>
  
  <pre><code>mat2=matrix(c('A','','','B','A','A','A','B'),2,4,byrow=T)
  </code></pre>
  
  <p>In other words, how do I pad the empty values?</p>
  
  <p>[In Excel I would use this formula in column B: B2=if(isblank(A2),B1,A2), and copy it down].</p>
  
  <p>How can I do this in R? </p>
  
  <p>Henk</p>