title: Generate table using all unique combinations from three columns with data.table in R
body: <p>I have three columns and I would like to interact them to form a new data.table that includes all the possible combinations.</p>
  
  <pre><code>col1 = c(1,2,3,4)
  col2= c(a,b)
  col3 = c(x,y)
  </code></pre>
  
  <p>I would like the resulting table to look like:</p>
  
  <pre><code>| col1 | col2 | col3 |
  -----------------------
  | 1 | a | x |
  | 1 | a | y |
  | 1 | b | x |
  | 1 | b | y |
  | 2 | a | x |
  ....
  </code></pre>
  
  <p>and so on.</p>
  
  <p>I can combine 2 of the columns using the merge command:</p>
  
  <pre><code>table1 = data.table(merge(unique(col1),unique(col2)))
  </code></pre>
  
  <p>But it doesnt work for three. Is this possible? Man thanks</p>