title: R summation pivot table
body: <p>for a data frame as follow</p>
  
  <pre><code>id&lt;-c(1,1,2,3,3,2)
  p&lt;-c(10,0,22,34,0,0)
  df&lt;-data.frame(id,p)
  </code></pre>
  
  <p>I need a summary table like </p>
  
  <pre><code>id   p
  1    10
  2    22
  3    34
  </code></pre>
  
  <p>which is actually aggregated summation of p for each id.
  can I get this with 'dcast'?</p>