title: Combining multiple rows into one row with multiple columns of data R
body: <p>I have a dataset where the same effect was measured in different ways and I want to compare those measurements. My dataset looks like this:</p>
  
  <pre><code>Study     MType     ID     Insect     Mean     Sd     N
  Alla      Fecundity  1      Aphid      .62      .7628  11
  Alla      RGR        1      Aphid      -32.8    7.76   11
  Ando      Survival   2      Bee        2.34     .67    8
  Ando      RGR        2      Bee        4.56     .34    10
  Ando      Fecundity  2      Bee        5.32     4.3    20
  </code></pre>
  
  <p>I want to combine the rows by ID number so that the MType, Mean, Sd and N for each row are preserved (although the column names need to change so the columns are distinguishable). </p>
  
  <p>Hopefully, in the end it would look like:</p>
  
  <p><code>Study  ID  Insect Fecundity.mean Fecundity.Sd Fecundity.N RGR.mean RGR.Sd...etc</code></p>
  
  <p>Some difficulties:</p>
  
  <ol>
  <li>There are about 10 different MTypes</li>
  <li>each ID number has between 2 and 4 MTypes</li>
  </ol>
  
  <p>I have messed around with reshape and with tidyr and I haven't been able to figure out how to do this with either of them. Please help! </p>