title: R reshape2 'Aggregation function missing: defaulting to length'
body: <p>I have seen this reshape2 several times on SO but haven't seen a solution to my particular problem;</p>
  
  <p>I have a dataset like this;</p>
  
  <pre><code>head(data)
  student    test    score
  Adam      Exam1     80
  Adam      Exam2     90
  John      Exam1     70
  John      Exam2     60
  </code></pre>
  
  <p>I am trying to cast this to a wide format that looks like this;</p>
  
  <pre><code>Student    Exam1    Exam2 ........ ExamX
  Adam         80       90
  John         70       60
  </code></pre>
  
  <p>using;</p>
  
  <pre><code>dcast(data,student~test,value.var='score')
  </code></pre>
  
  <p>but the data ends up looking like something like this;</p>
  
  <pre><code>Student    Exam1     Exam2
  Adam        0          0
  John        0          1
  </code></pre>
  
  <p>with this error;</p>
  
  <pre><code>Aggregation function missing: defaulting to length
  </code></pre>
  
  <p>Any ideas why it is changing all of these values to a (0 or 1)?</p>