title: Reorder and Group Multiple Columns by Regex/pattern
body: <p>I have the following:</p>
  <pre><code>a_aa a_ab a_ac b_aa b_ab b_ac
  2    3    3    3     1    2
  3    4    1    1     3    1
  </code></pre>
  <p>Desired outcome:</p>
  <pre><code>a_aa b_aa a_ab b_ab a_ac b_ac
  2    3    3    1     3    2
  3    1    4    3     1    1
  </code></pre>
  <p>Code with data:</p>
  <pre><code>d &lt;- &quot;a_aa a_ab a_ac b_aa   b_ab b_ac
  2    3    3    3     1    2
  3    4    1    1     3    1&quot;
  dd &lt;- read.table(textConnection(object = d), header = T)
  </code></pre>
  <p>My current solution is manual:</p>
  <pre><code>    dd %&gt;% select(a_aa, b_aa, a_ab, b_ab, a_ac, b_ac)
  </code></pre>
  <p>however, is onerous when number of columns is large. Any ideas how to do this kind of column ordering with grouping (e.g. sequence a_etc1, b_etc1, a_etc2, b_etc2)? Thank you!</p>