title: do.call to build and execute data.table commands
body: <p>I have a small <code>data.table</code> representing one record per test cell (AB testing results) and am wanting to add several more columns that compare each test cell, against each other test cell. In other words, the number of columns I want to add, will depend upon how many test cells are in the AB test in question.</p>
  
  <p>My <code>data.table</code> looks like:</p>
  
  <pre><code>Group   Delta     SD.diff
  Control     0           0
  Cell1 0.00200 0.001096139
  Cell2 0.00196 0.001095797
  Cell3 0.00210 0.001096992
  Cell4 0.00160 0.001092716
  </code></pre>
  
  <p>And I want to add the following columns (numbers are trash here):</p>
  
  <pre><code>Group v.Cell1    v.Cell2   v.Cell3   v.Cell4
  Control  0.45       0.41      0.45      0.41 
  Cell1    0.50       0.58      0.48      0.66
  Cell2    0.58       0.50      0.58      0.48
  Cell3    0.48       0.58      0.50      0.70
  Cell4    0.66       0.48      0.70      0.50
  </code></pre>
  
  <p>I am sure that <code>do.call</code> is the way to go, but I cant work out how to embed one do.call inside another to generate the script... and I can't work out how to then execute the scripts (20 lines in total). The closest I am currently is:</p>
  
  <pre><code>a &lt;- do.call("paste",c("test.1.results &lt;- mutate(test.1.results, P.Better.",list(unlist(test.1.results[,Group]))," = pnorm(Delta, test.1.results['",list(unlist(test.1.results[,Group])),"'][,Delta], SD.diff,lower.tail=TRUE))", sep=""))
  </code></pre>
  
  <p>Which produces 5 script lines like:</p>
  
  <pre><code>test.1.results &lt;- mutate(test.1.results, P.Better.Cell2 = pnorm(Delta, test.1.results['Cell2'][,Delta], SD.diff,lower.tail=TRUE))
  </code></pre>
  
  <p>Which only compares one test cell results against itself.. a 0.50 result (difference due to chance). No use what so ever as I need each test compared to each other.</p>
  
  <p>Not sure where to go with this one.</p>