title: Dynamic column names in data.table
body: <p>I am trying to add columns to my <code>data.table</code>, where the names are dynamic. I addition I need to use the <code>by</code> argument when adding these columns.  For example:</p>
  
  <pre><code>test_dtb &lt;- data.table(a = sample(1:100, 100), b = sample(1:100, 100), id = rep(1:10,10))
  cn &lt;- parse(text = "blah")
  test_dtb[ , eval(cn) := mean(a), by = id]
  
  # Error in `[.data.table`(test_dtb, , `:=`(eval(cn), mean(a)), by = id) : 
  #  LHS of := must be a single column name when with=TRUE. When with=FALSE the LHS may be a vector of column names or positions.
  </code></pre>
  
  <p>Another attempt:</p>
  
  <pre><code>cn &lt;- "blah"
  test_dtb[ , cn := mean(a), by = id, with = FALSE]
  # Error in `[.data.table`(test_dtb, , `:=`(cn, mean(a)), by = id, with = FALSE) : 'with' must be TRUE when 'by' or 'keyby' is provided
  </code></pre>
  
  <hr>
  
  <p><strong>Update from Matthew:</strong></p>
  
  <p>This now works in v1.8.3 on R-Forge. Thanks for highlighting!<br>
  See this similar question for new examples:</p>
  
  <p><a href="https://stackoverflow.com/questions/11680579/assign-multiple-columns-using-in-data-table-by-group">Assign multiple columns using data.table, by group</a></p>