title: R - Group data but apply different functions to different columns
body: <p>I'd like to group this data but apply different functions to some columns when grouping.</p>
  
  <pre><code>ID  type isDesc isImage
  1   1    1      0
  1   1    0      1
  1   1    0      1
  4   2    0      1
  4   2    1      0
  6   1    1      0
  6   1    0      1
  6   1    0      0
  </code></pre>
  
  <p>I want to group by <code>ID</code>, columns <code>isDesc</code> and <code>isImage</code> can be summed, but I would like to get the value of type as it is. <code>type</code> will be the same through the whole dataset. The result should look like this:</p>
  
  <pre><code>ID  type isDesc isImage
  1   1    1      2
  4   2    1      1
  6   1    1      1
  </code></pre>
  
  <p>Currently I am using</p>
  
  <pre><code>library(plyr)
  summarized = ddply(data, .(ID), numcolwise(sum))
  </code></pre>
  
  <p>but it simply sums up all the columns. You don't have to use <code>ddply</code> but if you think it's good for the job I'd like to stick to it. <code>data.table</code> library is also an alternative</p>