title: Getting "invalid 'type' (character) of argument" error with aggregate()
body: <p>I have the following CSV:</p>
  
  <pre><code>color,val2,val3
  blue,1,4
  green,7,3
  blue,4,2
  red,9,3
  red,2,6
  blue,1,7
  </code></pre>
  
  <p>I simply want to aggregate by color.</p>
  
  <p>When I'm trying:</p>
  
  <pre><code>csv &lt;- read.csv("/home/user/file.csv", stringsAsFactors=FALSE)
  data &lt;-aggregate(csv, list(csv[["color"]]), sum)
  </code></pre>
  
  <p>I get</p>
  
  <blockquote>
    <p>Error in FUN(X[[i]], ...) : invalid 'type' (character) of argument</p>
  </blockquote>