title: Using variable in data.table group by clause
body: <p>I have a data.table that I am trying to summarise. This is my approach</p>
  
  <pre><code>library(data.table)
  
  dtIris &lt;-data.table(iris)
  dt1 &lt;- dtIris[, list(AvgSepalWidth = mean(Sepal.Width)), 
                by=list(TrimSpecies = substr(Species,1,3),Petal.Length)]
  </code></pre>
  
  <p>I am wanting to be able to use a variable to identify one of the items to group by, I just can't get it to evalulate the variable in the list. It just treats it like a string and throws an error.</p>
  
  <pre><code>myvar &lt;- "Petal.Length"
  dt1 &lt;- dtIris[, list(AvgSepalWidth = mean(Sepal.Width)), 
                by=list(TrimSpecies = substr(Species,1,3),myvar)]
  </code></pre>
  
  <p>I have tried <code>noquote()</code>, <code>eval()</code>, <code>parse(text=)</code> all to no avail. Any guidance would be really appreciated.</p>