title: Convert a data frame to a data.table without copy
body: <p>I have a large data frame (in the order of several GB) that I'd like to convert to a <code>data.table</code>. Using <code>as.data.table</code> creates a copy of the data frame, which means I need available memory to be at least twice the size of the data. Is there a way to do the conversion without a copy?</p>
  
  <p>Here's a simple example to demonstrate:</p>
  
  <pre><code>library(data.table)
  N &lt;- 1e6
  K &lt;- 1e2
  data &lt;- as.data.frame(rep(data.frame(rnorm(N)), K))
  
  gc(reset=TRUE)
  tracemem(data)
  data &lt;- as.data.table(data)
  gc()
  </code></pre>
  
  <p>With output:</p>
  
  <pre><code>library(data.table)
  # data.table 1.8.10  For help type: help("data.table")
  N &lt;- 1e6
  K &lt;- 1e2
  data &lt;- as.data.frame(rep(data.frame(rnorm(N)), K))
  
  gc(reset=TRUE)
  # used  (Mb) gc trigger   (Mb)  max used  (Mb)
  # Ncells    303759  16.3     597831   32.0    303759  16.3
  # Vcells 100442572 766.4  402928632 3074.2 100442572 766.4
  tracemem(data)
  # [1] "&lt;0x363fda0&gt;"
  data &lt;- as.data.table(data)
  # tracemem[0x363fda0 -&gt; 0x31e4260]: copy as.data.table.data.frame as.data.table 
  gc()
  # used  (Mb) gc trigger   (Mb)  max used   (Mb)
  # Ncells    304519  16.3     597831   32.0    306162   16.4
  # Vcells 100444242 766.4  322342905 2459.3 200933219 1533.0
  </code></pre>