title: Aggregate function in r is not working on my dataset
body: <p>Sample Dataset</p>
  
  <pre>Date   Playerid    Revenue Promo   DayofWeek
  01/01/2017  146123  0   B   Sunday
  01/01/2017  219378  0   B   Sunday
  01/01/2017  198614  0   B   Sunday
  02/01/2017  292640  30  A   Monday
  02/01/2017  139562  10  A   Monday
  02/01/2017  124967  20  A   Monday
  02/01/2017  107954  20  A   Monday
  03/01/2017  28391   10  B   Tuesday
  03/01/2017  184388  21  B   Tuesday
  03/01/2017  264222  20  B   Tuesday
  03/01/2017  184857  0   B   Tuesday
  04/01/2017  79788   40  A   Wednesday
  </pre>
  
  <p>I wanted to Aggregate the table by DayofWeek, and sum up the revenue for each day of the week, count the number of players using the playerid such that my final output looks like this:</p>
  
  <pre> 
  Players Revenue Promo   DayofWeek
      3      0      B       Sunday
      4     80      A       Monday
      4     51      B       Tuesday
      1     40      A       Wednesday
  </pre>
  
  <p>I have been trying to aggregate the dataset attached above but all attempts were unsuccessful. Can you help, please?</p>
  
  <p>Here is my code below.</p>
  
  <pre><code>aggdata &lt;-aggregate(MyData, by=list(DayofWeek,Revenue, Promo, Playerid), 
                      FUN=sum, na.rm=TRUE)
  </code></pre>
  
  <p>I got the following errors</p>
  
  <pre><code>Error in FUN(X[[i]], ...) : invalid 'type' (character) of argument
  </code></pre>