title: Error in data.frame , unused argument
body: <p>I have this dataframe :</p>
  
  <pre><code>&gt; head(merged.tables)
    Store DayOfWeek       Date Sales Customers Open Promo StateHoliday SchoolHoliday StoreType
  1     1         5 2015-07-31  5263       555    1     1            0             1         c
  2     1         6 2013-01-12  4952       646    1     0            0             0         c
  3     1         5 2014-01-03  4190       552    1     0            0             1         c
  4     1         3 2014-12-03  6454       695    1     1            0             0         c
  5     1         3 2013-11-13  3310       464    1     0            0             0         c
  6     1         7 2013-10-27     0         0    0     0            0             0         c
    Assortment CompetitionDistance CompetitionOpenSinceMonth CompetitionOpenSinceYear Promo2
  1          a                1270                         9                     2008      0
  2          a                1270                         9                     2008      0
  3          a                1270                         9                     2008      0
  4          a                1270                         9                     2008      0
  5          a                1270                         9                     2008      0
  6          a                1270                         9                     2008      0
    Promo2SinceWeek Promo2SinceYear PromoInterval
  1              NA              NA              
  2              NA              NA              
  3              NA              NA              
  4              NA              NA              
  5              NA              NA              
  6              NA              NA       
  </code></pre>
  
  <p>Then I want to extract a dataframe showing <strong>the average of Sales</strong> vector when <strong>Open equal to 1</strong> and by <strong>StoreType</strong>. 
  I used this command because it's the fatest I think:</p>
  
  <pre><code>merged.tables[StateHoliday==1,mean(na.omit(Sales)),by=StoreType]
  </code></pre>
  
  <p>But I got this error:</p>
  
  <blockquote>
    <p>Error in [.data.frame(merged.tables, StateHoliday == 0,
    mean(na.omit(Sales)),  :    unused argument (by = StoreType)</p>
  </blockquote>
  
  <p>I search but I didn't get an answer to this error. Thanks for your help!</p>