title: Pivoting rows into columns
body: <p>Suppose (to simplify) I have a table containing some control vs. treatment data:</p>
  
  <pre><code>Which, Color, Response, Count
  Control, Red, 2, 10
  Control, Blue, 3, 20
  Treatment, Red, 1, 14
  Treatment, Blue, 4, 21
  </code></pre>
  
  <p>For each color, I want a single row with the control and treatment data, i.e.:</p>
  
  <pre><code>Color, Response.Control, Count.Control, Response.Treatment, Count.Treatment
  Red, 2, 10, 1, 14
  Blue, 3, 20, 4, 21
  </code></pre>
  
  <p>I guess one way of doing this is by using an internal merge on each control/treatment subset (merging on the Color column), but is there a better way? I was thinking the reshape package or the stack function could somehow do it, but I'm not sure.</p>