4

I am building an R package with packrat. The package is fully tested and installation from the locally saved source file by

install.packages("myPackage.tar.gz", repos = NULL, type = "source")

works if all dependencies (specified in the Imports: field) are installed on the local machine. However, I would like to install that package on another server where dependencies are not installed. When I try to do this, I get the error

"ERROR: dependencies ‘survey’, ‘dplyr’ are not available for package 'myPackage'"

I also tried to install the packrat bundle which I created by calling

packrat::bundle(project = 'pathtomypackageproject', file = 'myPackage.tar.gz',
                include.lib = TRUE)

but I get the same error.

I think the problem is that, upon installing 'myPackage', R searches the first element of .libPaths(), doesn't find anything and since "repos = NULL" is specified, has nowhere to install the packages from so the error is thrown.

A solution I'm still trying to avoid is to transfer a repository containing all dependencies to the server and pointing to the repository when installing the package. Ideally, I only have to transfer myPackage.tar.gz.

My question is if there is some way to point to the internal packrat library, where all dependencies can be found, and import the namespaces from there.

denise
  • 149
  • 14

1 Answers1

0

If you have included the list of packages to be imported in DESCRIPTION File, then you just need to do this while installation of your package:

  install.packages("myPackage",dependencies=TRUE)
Sowmya S. Manian
  • 3,723
  • 3
  • 18
  • 30
  • This however only works when I install my package from CRAN or if I have all the dependencies' source files saved locally. What I want to achieve is that only one package needs to be installed. If this package has an internal library containing all dependencies, I thought there might be a way to point the namespace import to that internal library. Because technically, all dependencies can be found, R is just not searching the right place! – denise Apr 10 '16 at 11:19
  • What I want is pretty much what Hadley mentions here: https://github.com/rstudio/packrat/issues/31#issuecomment-208313921 but this issue doesn't seem to be solved yet. If anyone has an idea how to manually solve this I'd be super thankful ! – denise Apr 11 '16 at 12:30