title: Select / assign to data.table when variable names are stored in a character vector
body: <p>How do you refer to variables in a <code>data.table</code> if the variable names are stored in a character vector? For instance, this works for a <code>data.frame</code>:</p>
  
  <pre><code>df &lt;- data.frame(col1 = 1:3)
  colname &lt;- "col1"
  df[colname] &lt;- 4:6
  df
  #   col1
  # 1    4
  # 2    5
  # 3    6
  </code></pre>
  
  <p></p>
  
  <p>How can I perform this same operation for a data.table, either with or without <code>:=</code> notation? The obvious thing of <code>dt[ , list(colname)]</code> doesn't work (nor did I expect it to).   </p>