title: R data.table dynamic column name of group by returning new table
body: <p>By default a group by operation on a data.table returns a new data.table with an automatically named column <code>V1</code>:</p>
  
  <pre><code>dt &lt;- data.table(a = sample(1:100, 100), b = sample(1:100, 100), id = rep(1:10,10))
  dt[, mean(a), by = id]
  
  #     id V1
  # 1:  1 48.2
  # 2:  2 47.9
  # 3:  3 46.8
  # 4:  4 54.7
  # 5:  5 63.7
  # 6:  6 50.6
  # 7:  7 43.3
  # 8:  8 52.7
  # 9:  9 45.4
  # 10: 10 51.7
  </code></pre>
  
  <p>Following <a href="https://stackoverflow.com/questions/32124630/data-table-group-by-sum-name-new-column-and-slice-columns-in-one-step">this post</a> I can set the name of the column with the results like so</p>
  
  <pre><code>dt[, list(mean = mean(a)), by = id]
  </code></pre>
  
  <p>Is it possible to have a variable for the column name? E.g., instead of setting <code>mean</code> explicitly I would like to do something like</p>
  
  <pre><code>column_name &lt;- "mean"
  dt[, list(column_name = mean(a)), by = id]  # resulting column name is column_name (and not mean)
  </code></pre>