title: Why does mutate() by group take forever?
body: <p>I have a 2.5M x 13 matrix which I try to aggregate by an ID variable. At first I tried with using ddply, but my memory exploded. Afterwards I tried using data.table, which works a lot faster:</p>
  
  <pre><code>data &lt;- as.data.table(data)
  key(data) &lt;- "ID"
  
  agg&lt;-mydata[,mutate(.SD,
             start = min(Date))
             , by = ID]
  </code></pre>
  
  <p>Now there's no memory problem, though, so far it takes more than ~4 hours to run this on an Intel i5 2.50GHz with 4.0GB of RAM. Operating system is windows 7, so no parallel computing.</p>
  
  <p>What am I doing wrong?</p>