title: R Replicating until length is met
body: <p>Say we have the following:</p>
  
  <pre><code>a=c( 1, 9, 5, 7, 8, 11)
  length(a) ## 6
  </code></pre>
  
  <p>and I want to obtain:</p>
  
  <pre><code>a_desired=c( 1, 1, 9, 9, 5, 5, 7, 7, 8, 11)
  length(a_desired) ## 10
  </code></pre>
  
  <p>Basically it stops replicating when it reaches the desired length, in this case 10.</p>
  
  <p>If the desired length is 14, </p>
  
  <pre><code>a_desired=c( 1, 1, 1, 9, 9, 9, 5, 5, 7, 7, 8, 8, 11, 11)
  </code></pre>
  
  <p>Does anyone have a suggestion on how to obtain this or perhaps a link on something similar asked before ?(I'm not too sure what keyword to look for)</p>