I am developing an R package that wraps the rmongodb
package and creates a developer-friendly interface for working with MongoDB. The package uses proto
internally.
I'd like to export a single factory method via a proto object (an environment) called MongoDB
, whose definition is:
MongoDB <- proto(
new = function(., ...) {
# Good stuff in here...
}
)
During development with RStudio & devtools
and during local testing this does not seem to be a problem. However, I am experiencing several problems:
devtools::check()
insists on putting animport(MongoDB)
in my NAMESPACE file which makesR CMD check
fail with "Namespace dependency not required: 'MongoDB'".When I remove this import directive,
R CMD check
fails with "object 'MongoDB' not found" while running mytestthat
tests, even if I manually addexport(MongoDB)
. However,devtools::test()
works fine in RStudio.
What is the recommended way of exporting proto
objects, which are environments, from R packages?
Update:
Per Gabor's suggestion below, I've made sure that MongoDB.Rd
declares MongoDB
as data (the link has the source). I still get a failure in MongoDB
not being visible in the tests (which use testthat
). My DESCRIPTION
file is here and NAMESPACE
is here.