title: Re-ordering data.frame from AAABBBCCC to ABCABCABC
body: <p>I have data.frame which is currently ordered alhphabetically by N replicates of each letter. How can I order it such that the rows look like: ABC...ABC...ABC...?</p>
  <pre><code>N=1e1
  df&lt;-data.frame(x=runif(N),y=rep(c(&quot;A&quot;,&quot;B&quot;,&quot;C&quot;),each=N)
  </code></pre>
  <p>which looks like:</p>
  <pre><code>              x y
  1 0.01757513 A
  2 0.39505796 A
  3 0.95014487 A
  4 0.01757513 B
  5 0.39505796 B
  6 0.95014487 B
  7 0.01757513 C
  8 0.39505796 C
  9 0.95014487 C
  </code></pre>
  <p>Output that I'm trying to make is:</p>
  <pre><code>A 0.4
  B 0.3
  C 0.2
  A 0.1
  B 0.3
  C 0.1
  </code></pre>