As a minimal working example, I'm trying to import some objects from the MASS
package into my own package (called Test
) - take the abbey
dataset for example:
### 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)
I hit Build & Reload
in RStudio and get the error:
==> 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
==> 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.
It seems that even the most basic import
has failed - the system can't find abbey
. Clearly I must be overlooking something obvious - what's going wrong?