title: Aggregate data using each() with reshape2::dcast
body: <p>I'm usually using <code>reshape</code> package to aggregate some data (d'uh), usually with <code>plyr</code>, because of its uber-awesome function <code>each</code>. Recently, I received a suggestion to switch to <code>reshape2</code> and try it out, and now I can't seem to use <code>each</code> wizardry anymore.</p>
  
  <h3>reshape</h3>
  
  <pre><code>&gt; m &lt;- melt(mtcars, id.vars = c("am", "vs"), measure.vars = "hp")
  &gt; cast(m, am + vs ~ variable, each(min, max, mean, sd))
    am vs hp_min hp_max   hp_mean    hp_sd
  1  0  0    150    245 194.16667 33.35984
  2  0  1     62    123 102.14286 20.93186
  3  1  0     91    335 180.83333 98.81582
  4  1  1     52    113  80.57143 24.14441
  </code></pre>
  
  <h3>reshape2</h3>
  
  <pre><code>require(plyr)
  &gt; m &lt;- melt(mtcars, id.vars = c("am", "vs"), measure.vars = "hp")
  &gt; dcast(m, am + vs ~ variable, each(min, max, mean, sd))
  Error in structure(ordered, dim = ns) : 
    dims [product 4] do not match the length of object [16]
  In addition: Warning messages:
  1: In fs[[i]](x, ...) : no non-missing arguments to min; returning Inf
  2: In fs[[i]](x, ...) : no non-missing arguments to max; returning -Inf
  </code></pre>
  
  <p>I wasn't into mood to comb this down, as my previous code works like a charm with <code>reshape</code>, but I'd really like to know:</p>
  
  <ol>
  <li>is it possible to use <code>each</code> with <code>dcast</code>?</li>
  <li>is it advisable to use <code>reshape2</code> at all? is <code>reshape</code> deprecated?</li>
  </ol>