title: Sort a data frame by group sum first, then by frequency
body: <p>I have the following data in a data.frame:</p>
  
  <pre><code>reg        id    n
  Echo       E1    7
  Charlie    C1    3
  Alpha      A1    5
  Echo       E2    1
  Alpha      A2    4
  Charlie    C2    9
  </code></pre>
  
  <p>I am trying to sort it by reg sum first, then by n (both decreasing).
  The result would be:</p>
  
  <pre><code>reg        id    n
  Charlie    C2    9
  Charlie    C1    3
  Alpha      A1    5
  Alpha      A2    4
  Echo       E1    7
  Echo       E2    1
  </code></pre>
  
  <p>Because Charlie has 12, Alpha has 9 and Echo has 8.</p>
  
  <p>So far, I've only been able to group and do the second part of the sorting (through poor use of dplyr). The reg column still gets sorted alphabetically.</p>
  
  <p>Is there an elegant solution to this?</p>