title: Merge data tables like data frames in R
body: <p>Due to time constraints, I've decided to use data tables in my code instead of data frames, as they are much faster. However, I still want the functionality of data frames. I need to merge two data tables, conserving all values (like setting all=TRUE in merge). </p>
  
  <p>Some example code:</p>
  
  
  
  <pre><code>&gt; x1 = data.frame(index = 1:10)
  &gt; y1 = data.frame(index = c(2,4,6), weight = c(.2, .5, .3))
  &gt; x1
     index
  1      1
  2      2
  3      3
  4      4
  5      5
  6      6
  7      7
  8      8
  9      9
  10    10
  &gt; y1
    index weight
  1     2    0.2
  2     4    0.5
  3     6    0.3
  
  &gt; merge(x,y, all=TRUE)
        index weight
   [1,]     1     NA
   [2,]     2      1
   [3,]     3     NA
   [4,]     4      2
   [5,]     5     NA
   [6,]     6      3
   [7,]     7     NA
   [8,]     8     NA
   [9,]     9     NA
  [10,]    10     NA
  </code></pre>
  
  <p>Now can I do a similar thing with data tables? (The NA's don't necessarily have to stay, I change them to 0's anyways). </p>
  
  <pre><code>&gt; x2 = data.table(index = 1:10, key ="index")
  &gt; y2 = data.table(index = c(2,4,6), weight= c(.3,.5,.2))
  </code></pre>
  
  <p>I know you can merge, but I also know that there is a faster way.</p>