title: Have function that returns a list create new columns and expand `data.table`
body: <p>I'm trying to create a <code>data.table</code> from a <code>data.table</code> that has more numerous rows than the input <code>data.table</code>.</p>
  <pre><code>dt &lt;- data.table(
    A = sample(LETTERS, size = 1000, replace = TRUE),
    B = sample(1:1000, size = 1000, replace = TRUE),
    C = sample(1:1000, size = 1000, replace = TRUE),
    D = sample(1:1000, size = 1000, replace = TRUE)
  )
  
  dt.fun &lt;- function(b, c, d) {
    bcd &lt;- b + c + d
    bc &lt;- b + c
    cd &lt;- b + d
    return(list(bcd, bc, cd))
  }
  </code></pre>
  <p>The results I get back from <code>dt[, .(dt.fun(B, C, D))), by = c('A')</code> look like below:</p>
  <pre><code>   A                                V1
   1: T 1294,1827,1965,1476,1680,2494,...
   2: T  602, 837,1215, 907,1473,1505,...
   3: T 1156,1550,1385,1240,1007,1751,...
   4: B 1666,1894,1696,1683,2276,1530,...
   5: B 1365,1078,1398, 830,1483, 821,...
   6: B  981,1151,1082,1677,1391,1475,...
   7: K 1227,1381,2173,1156,1269,1209,...
   8: K  681,1066,1212, 662, 954, 999,...
   9: K  814, 499,1368,1012, 933, 264,...
  10: C  625,2275,1019,1449,1115,2043,...
  11: C  149,1532, 927,1230, 712,1652,...
  12: C  617,1627, 103, 850, 988,1067,...
  13: J 1122,2048,2347,2013,1974,1146,...
  14: J  298,1158,1525,1119,1362,1106,...
  15: J  908,1350,1692,1055,1181, 654,...
  16: E 1918,1661,1684,1378,2442,1262,...
  17: E 1198, 817, 899,1340,1578, 741,...
  18: E 1025,1392, 949, 808,1826, 583,...
  19: M 1818,1915,1716,1083,1524,1402,...
  20: M 1305, 973, 871, 993, 966, 574,...
  21: M 1475,1196, 926, 918,1042,1089,...
  22: U 1718,1962,1880, 564, 726,1249,...
  23: U 1371,1162,1365, 430, 147, 909,...
  24: U 1250,1183,1019, 246, 722, 651,...
  25: G 2405,2419, 632,1753,1993,1803,...
  26: G 1797,1498, 307,1325,1422,1184,...
  27: G 1582,1682, 488,1335,1015,1518,...
  28: P 1889,1839,1445,1603,1034,1161,...
  29: P 1130,1271, 789,1556, 906, 432,...
  30: P 1671,1304, 846, 818, 819,1061,...
  </code></pre>
  <p>What am I doing wrong and how can I get the function to return each element of the list as a separate column?</p>