title: colSums and group by
body: <p>I have the following table below:</p>
  
  <pre><code>+-----------+--------+--------+--------+
  | Condition | LabelA | LabelB | LabelC |
  +-----------+--------+--------+--------+
  | TRUE      |      1 |      1 |      0 |
  | TRUE      |      0 |      1 |      0 |
  | FALSE     |      0 |      1 |      1 |
  | FALSE     |      1 |      0 |      1 |
  | TRUE      |      1 |      1 |      0 |
  +-----------+--------+--------+--------+
  </code></pre>
  
  <p>Which I'd like to summarise (sum aggregation) into:</p>
  
  <pre><code>+--------+------+-------+
  | Labels | TRUE | FALSE |
  +--------+------+-------+
  | LabelA |    2 |     1 |
  | LabelB |    3 |     1 |
  | LabelC |    0 |     2 |
  +--------+------+-------+
  </code></pre>
  
  <p>I can do this by creating two sub tables on whether <code>Condition == TRUE</code> and then <code>colSums</code> that table, however I suspect there is a more elegant way to keep everything into one table (shown above).</p>
  
  <p>This differs from <a href="https://stackoverflow.com/questions/32545710/r-how-to-sum-columns-grouped-by-a-factor">this example</a> because the column names (LabelA, LabelB, LabelC) become rows.</p>