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

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!

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

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 Likes

They use Tools -> Install Packages from RStudio.

That works! Thanks so much, Jim.

1 Like