title: Repeating arrays of numbers in R
body: <p>I'd like to understand the syntax for elegantly asking R to populate repetitive numbers in a data frame. </p>
  
  <p>I need to count from 1 to 256 64 * 3 times, which I found straightforward enough.</p>
  
  <p><code>df$Address&lt;-rep(1:256,192)</code></p>
  
  <p>I need a column to repeat a 1 256*64 rows, then repeat a 3 256*64 rows, then repeat a 5 256*64 rows. I found that one to be intuitive.</p>
  
  <p><code>df$Gain&lt;-c(rep(1,256*64),rep(3,256*64),rep(5,256*64))</code></p>
  
  <p>But I can't seem to grasp the syntax for needing to repeat 1 256 times, then 2 256 times, then 3 256 times up to 64 256 times, all 3 times. I wanted something like this to work, but it doesn't:</p>
  
  <p><code>df$Ref&lt;-rep(rep(1,256):64*3)</code></p>
  
  <p>What's an elegant way to repeat a number 256 times and then increment that number and repeat?</p>