title: R data.table create multiple columns in one go
body: <p>This question is about a specific data.table operation.</p>
  
  <p>I have:</p>
  
  <pre><code>dataDT &lt;- data.table(ID = c(1:3))
  dataDT
  &gt; dataDT
     ID
  1:  1
  2:  2
  3:  3
  </code></pre>
  
  <p>I want to create three new columns to store data from 3 different sources.</p>
  
  <pre><code>targetDT &lt;- data.table(ID = c(1:3), ID1 = c(1:3), ID2 = c(1:3), ID3 = c(1:3))
  targetDT
  &gt; targetDT
     ID ID1 ID2 ID3
  1:  1   1   1   1
  2:  2   2   2   2
  3:  3   3   3   3
  </code></pre>
  
  <p>So I've tried:</p>
  
  <pre><code>tempDT_1 &lt;- data.table(ID1 = c(1:3))    # create dummy source 1
  tempDT_2 &lt;- data.table(ID2 = c(1:3))    # create dummy source 2
  tempDT_3 &lt;- data.table(ID3 = c(1:3))    # create dummy source 3
  
  dataDT[, c("A", "B", "c") := list(tempDT_1, tempDT_2, tempDT_3)]
  dataDT
  &gt; dataDT
     ID     A     B     c
  1:  1 1,2,3 1,2,3 1,2,3
  2:  2 1,2,3 1,2,3 1,2,3
  3:  3 1,2,3 1,2,3 1,2,3
  </code></pre>
  
  <p>Why the above <code>list(tempDT_1, tempDT_2, tempDT_3)</code> "not working properly"?</p>
  
  <p>I have seen people do things like:</p>
  
  <pre><code>dataDT[, c("A", "B", "c") := list(sum(ID), mean(ID), func(ID))]
  </code></pre>
  
  <p>that uses <code>list()</code> to "cbind" new values.</p>
  
  <p>How should I fix my codes?</p>