title: Recursively repeat vector elements N times each
body: <p>I want to repeat a vector N times but element-wise, not the whole vector.</p>
  
  <p>For instance, I have:</p>
  
  <pre><code>v &lt;- c('a', 'b')
  </code></pre>
  
  <p>Say I want to repeat n times:</p>
  
  <pre><code>n &lt;- 3
  </code></pre>
  
  <p>I want:</p>
  
  <pre><code>vfill &lt;- c(rep(v[1], n), rep(v[2], n))
  print(vfill)
  [1] "a" "a" "a" "b" "b" "b"
  </code></pre>
  
  <p>My best solution to date:</p>
  
  <pre><code>ffillv &lt;- function(i) rep(v[i], n)
  c(sapply(seq_len(length(v)), ffillv))
  </code></pre>
  
  <p>I am interested in fast &amp; scalable solutions, for instance using rbind, plyr, etc.</p>