title: Writing R packages: how to import another package?
body: <p>As a minimal working example, I'm trying to import some objects from the <a href="http://cran.r-project.org/package=MASS" rel="nofollow"><code>MASS</code></a> package into my own package (called <code>Test</code>) - take the <code>abbey</code> dataset for example:</p>
  
  <pre><code>### In R/Test.R:
  #' @import MASS
  abbey     # Check that the dataset has been imported OK
  
  ### DESCRIPTION:
  Package: Test
  ...
  Imports: MASS
  
  ### NAMESPACE:
  # Generated by roxygen2 (4.0.1): do not edit by hand
  import(MASS)
  </code></pre>
  
  <p>I hit <code>Build &amp; Reload</code> in RStudio and get the error:</p>
  
  <pre><code>==&gt; devtools::document(roclets=c('rd', 'collate', 'namespace'))
  
  Updating Test documentation
  Loading Test
  Error in eval(expr, envir, enclos) : object 'abbey' not found
  Writing NAMESPACE
  Documentation completed
  
  ==&gt; Rcmd.exe INSTALL --no-multiarch --with-keep.source Test
  
  * installing to library '.../R/R-3.1.0/library'
  * installing *source* package 'Test' ...
  ** R
  ** preparing package for lazy loading
  Error in eval(expr, envir, enclos) : object 'abbey' not found
  Error : unable to load R code in package 'Test'
  ERROR: lazy loading failed for package 'Test'
  * removing '.../R/R-3.1.0/library/Test'
  * restoring previous '.../R/R-3.1.0/library/Test'
  
  Exited with status 1.
  </code></pre>
  
  <p>It seems that even the most basic <code>import</code> has failed - the system can't find <code>abbey</code>. Clearly I must be overlooking something obvious - what's going wrong?</p>