title: Error rased in reshape function in R, with count aggregation.
body: <p>I am working on a simple dataframe looks like:</p>
  
  <pre><code>id    event
  111    hit
  111    eat
  222    hit
  222    eat
  222    eat
  333    hit
  333    hit
  333    hit
  333    eat
  </code></pre>
  
  <p>I want to reshape and count based on the event type. So the output table should looks like:</p>
  
  <pre><code>id   hit   eat
  111  1     1
  222  1     2
  333  3     1 
  </code></pre>
  
  <p>my R command is:</p>
  
  <pre><code>dcast(mydf, id ~ event, value.var = "event", fun.aggregate=count)
  </code></pre>
  
  <p>It reports error:</p>
  
  <pre><code>Error in dim(ordered) &lt;- ns : 
    dims [product 167260] do not match the length of object [334520]
  </code></pre>
  
  <p>I don't understand where I am wrong. Please help...</p>