title: Transpose/reshape rows based on row values in R
body: <p>I have the following data.</p>
  
  <pre><code>ID      Date        Day             Sedentary   Light
  4701    04/02/2013  Monday          511.5        133.7
  4701    08/02/2013  Friday          370.2        113.0
  4702    04/02/2013  Monday          405.5        119.2
  4702    05/02/2013  Tuesday         601.8        162.5
  4702    06/02/2013  Wednesday       463.0        121.7
  4702    07/02/2013  Thursday        472.3        149.2
  4702    08/02/2013  Friday          383.2        106.5
  4704    06/02/2013  Wednesday       594.7        153.8
  4704    07/02/2013  Thursday        616.0        115.0
  </code></pre>
  
  <p>I would like to use the ID value in column 1 to transpose the data so that the data for each unique ID number is transposed from rows into columns i.e.</p>
  
  <pre><code>ID      D1date      D1day   D1Sedentary D1Light D2date      D2day   D2Sedentary D2Light
  4701    04/02/2013  Monday  511.5       133.7   08/02/2013  Friday  511.5       133.7
  </code></pre>
  
  <p>The number of rows that require transposing for each ID number range from 1-7.</p>
  
  <p>Many thanks for any help from a novice R user.</p>