title: data.table works in console but fails with R CMD INSTALL
body: <p>Minimal example: I have an R package whose sole .R file contains the code</p>
  
  <pre><code>data.table::data.table(iris)[Species == "setosa"]
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>    Sepal.Length Sepal.Width Petal.Length Petal.Width Species
   1:          5.1         3.5          1.4         0.2  setosa
   2:          4.9         3.0          1.4         0.2  setosa
   ...
  </code></pre>
  
  <p>This runs fine interactively (and when compiling with <a href="http://yihui.name/knitr/" rel="nofollow">knitr</a>, and with <code>r --vanilla</code>).</p>
  
  <p><strong>However, when I run <code>R CMD INSTALL</code> on the package, it fails with:</strong></p>
  
  <pre><code>Error in `[.data.frame`(x, i, j) : object 'Species' not found
  </code></pre>
  
  <p>Why would this happen only with R CMD INSTALL, and how can I avoid it?</p>
  
  <p><em><strong>Details:</strong></em></p>
  
  <p><strong>Package Imports</strong></p>
  
  <p>The package DESCRIPTION file includes the line</p>
  
  <pre><code>Imports: data.table
  </code></pre>
  
  <p><strong>Transcript of failed R CMD INSTALL</strong></p>
  
  <pre><code>Rcmd.exe INSTALL --no-multiarch --with-keep.source MYPKG
  
  * installing to library 'C:/Users/.../Documents/R/win-library/3.2'
  * installing *source* package 'MYPKG' ...
  ** R
  ** inst
  ** preparing package for lazy loading
  Error in `[.data.frame`(x, i) : object 'Species' not found
  Error : unable to load R code in package 'MYPKG'
  ERROR: lazy loading failed for package 'MYPKG'
  * removing 'C:/Users/.../Documents/R/win-library/3.2/MYPKG'
  * restoring previous 'C:/Users/.../Documents/R/win-library/3.2/MYPKG'
  
  Exited with status 1.
  </code></pre>
  
  <p><strong>Version information</strong></p>
  
  <pre><code>&gt; sessionInfo()
  R version 3.2.3 (2015-12-10)
  Platform: x86_64-w64-mingw32/x64 (64-bit)
  Running under: Windows 8.1 x64 (build 9600)
  
  locale:
  [1] LC_COLLATE=Norwegian (Bokmål)_Norway.1252
  [2] LC_CTYPE=Norwegian (Bokmål)_Norway.1252
  [3] LC_MONETARY=Norwegian (Bokmål)_Norway.1252
  [4] LC_NUMERIC=C
  [5] LC_TIME=Norwegian (Bokmål)_Norway.1252
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base
  
  loaded via a namespace (and not attached):
  [1] data.table_1.9.7 chron_2.3-47
  </code></pre>