title: Correlationmatrix from data table
body: <p>If I have the following data table:</p>
  
  <pre><code>set.seed(1)
  TDT &lt;- data.table(Group = c(rep("A",40),rep("B",60)),
                        Id = c(rep(1,20),rep(2,20),rep(3,20),rep(4,20),rep(5,20)),
                        Time = rep(seq(as.Date("2010-01-03"), length=20, by="1 month") - 1,5),
                        norm = round(runif(100)/10,2),
                        x1 = sample(100,100),
                        x2 = round(rnorm(100,0.75,0.3),2),
                        x3 = round(rnorm(100,0.75,0.3),2),
                        x4 = round(rnorm(100,0.75,0.3),2),
                        x5 = round(rnorm(100,0.75,0.3),2))
  </code></pre>
  
  <p>How can I calculate the correlations between x1, x2, x3, x4 and x5 by Time? </p>
  
  <p>This:</p>
  
  <pre><code>TDT[,x:= list(cor(TDT[,5:9])), by = Time]
  </code></pre>
  
  <p>does not work.</p>
  
  <p>How can it be done in <code>datatable</code>?</p>