title: Converting dataframe to partial "wide" and partial summary by group
body: <p>I have the following data frame</p>
  
  <pre><code>id datestamp hrofday val1 val2 val3
  a  20120401 0 3.2 0 1
  a  20120401 1 3.3 4 0
  a  20120401 2 3.4 6 0
  ...
  a  20120401 23 7.3 0 2
  </code></pre>
  
  <p>It represents a user-id followed by hour of day, val1 val2 &amp; val3.
  I want to use cast to put the data frame in the following shape using either reshape or base R. For every id I want the values in val1 in each of the 24 fields and simultaneously find the total for val2 &amp; val3. e.g. shown below</p>
  
  <pre><code>id datestamp val1.0 val1.1 val1.2 ... val1.23 total.val2 total.val3
  a  20120401 3.2 3.3 3.4 ... 7.3 10 3
  ...
  </code></pre>
  
  <p>Any help much appreciated. Thanks in advance.</p>