title: Grouping by column using get() while using a filter does not work in some situations
body: <p>I have a data.table which I want to filter and aggregate where some columns to group by are fixed and some come from function arguments.
  This combination yields an error message.</p>
  
  <p>Here is a simple and reproducible example</p>
  
  <pre><code>dt &lt;- data.table(A = rnorm(10), 
               B = sample(c("1", "2"), 10, replace = TRUE), 
               C = sample(c("1", "2"), 10, replace = TRUE))
  col1 &lt;- "B"
  
  dt[B == "1", mean(A), by = .(get(col1))]      # works
  dt[B == "1", mean(A), by = .(C, get(col1))]   # does not work
  dt[, mean(A), by = .(C, get(col1))]           # works
  dt[B == "1", mean(A), by = c("C", col1)]      # works and returns the intended result
  dt[B == "1"][, mean(A), by = .(C, get(col1))] # works and returns the intended result
  </code></pre>
  
  <p>I don't understand why <code>dt[B == "1", mean(A), by = .(C, get(col1))]</code> does not work while chaining in <code>dt[B == "1"][, mean(A), by = .(C, get(col1))]</code> does.</p>