title: dcast warning: ‘Aggregation function missing: defaulting to length’
body: <p>My <code>df</code> looks like this:</p>
  <pre><code>Id  Task Type    Freq  
  3     1    A       2
  3     1    B       3
  3     2    A       3
  3     2    B       0
  4     1    A       3
  4     1    B       3
  4     2    A       1
  4     2    B       3
  </code></pre>
  <p>I want to restructure by Id and get:</p>
  <pre><code>Id   A    B …  Z    
  3    5    3      
  4    4    6        
  </code></pre>
  <p>I tried:</p>
  <pre><code>df_wide &lt;- dcast(df, Id + Task ~ Type, value.var=&quot;Freq&quot;)
  </code></pre>
  <p>and got the following warning:</p>
  <blockquote>
  <p>Aggregation function missing: defaulting to length</p>
  </blockquote>
  <p>I can't figure out what to put in the <code>fun.aggregate</code>. What's the problem?</p>