How come required packages do not get auto-installed when my users do not have the packages in their system?


#1

I wrote an internal package, which runs successfully on my computer. However, when my users (who do not have the packages required) use my package, they will get an error saying the required package is not available. When they manually install the packages from CRAN, then my package would work.

Shouldn't those packages get auto-installed? Do my users need to install all the required packages manually from CRAN before using mine?

Some background information:

  • I put all the required packages in the Imports field in DESCRIPTION.
  • I use the convention package_name::function_name in my script.
  • My users install my packages from their local directory (not from CRAN).

The recommendation from Stack Overflow would be to use the drat package.

Any other recommendations? Any suggestions would be helpful. Thanks!


#2

What's the R code your users use to install your package?


#3

If they are installing it locally with install.packages("pkgname.tar.gz", repos = NULL) then no package dependencies will be installed, because you are not providing a CRAN repo to install to.

You can use devtools::install_local("pkgname.tar.gz") to install the package and any dependencies will be installed.


#5

They use Tools -> Install Packages from RStudio.


#6

That works! Thanks so much, Jim.