title: Repetitive vectors in R
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3672527/r-generate-a-repeating-sequence-based-on-vector">R: generate a repeating sequence based on vector</a>  </p>
  </blockquote>
  
  
  
  <p>To create the vector 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 is easy in one line, just type this into the command line and the appropriate output comes out immediately:</p>
  
  <pre><code>c(rep(1:3, 5))
  </code></pre>
  
  <p>But is there a similarly easy way to produce the vector 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 ?</p>
  
  <p>The pattern of the repetition is different but it's not obvious to me why it's not amenable to a very simple solution. It's possible to do this with a "for" loop without too much difficulty, but can it be all compressed into one "line"?</p>