title: Transposition with aggregation of data.table
body: <p>Suppose that we have <code>data.table</code> like that:</p>
  
  <pre><code>    TYPE KEY  VALUE
  1:  1    A    10
  2:  1    B    10
  3:  1    A    40
  4:  2    B    20
  5:  2    B    40
  </code></pre>
  
  <p>I need to generate the following aggregated <code>data.table</code> (numbers are sums of values for given TYPE and KEY):</p>
  
  <pre><code>    TYPE A    B
  1:  1    50   10
  2:  2    0    60
  </code></pre>
  
  <p>In a real life problem there are a lot of different values for KEY so it's impossible to hardcode them.</p>
  
  <p>How can I achieve that?</p>