Does R provides a dependency management tool?

package-dependencies

#1

Hi. I'm looking for a tool like pip for Python and npm for Node.js that could specify my R app dependencies and install when needed. Anyone knows if R has this tool?


#2

I think you will be interested in the #r-admin:package-manager channel. I will move your thread there.

This is also related to a topic there

Here is a list of tools that I know of and that could be useful to you

  • packrat from rstudio is a great way to isolate environment. it uses a packrat.lock file for storing dependencies
  • jetpack is designed as a CLI, above packrat. Another approach really interesting, that uses a DESCRIPTION file - the same used for package.
  • rsuite , a more integrated solution
  • automagic uses a deps.yaml to then automatically install missing dependency.
  • deplearning which will scan a code to identify missing dependencies
  • autoinst does basically the same. Install missing dependencies.

based on the way you asked your question, the two first could be of interest to you.

Personnaly, I currently use packrat for dependencies management to prepare deployment.


#3

If you create a package for your app, you can specify the dependencies. Then, if people can install it from a CRAN-like repository, whenever somebody runs install.packages("mypackage"), it will automatically install all dependencies.

Setting up a package repository isn't hard. You just need a drive or server everyone can access and to follow the official instructions. Then have people add it to the list of repositories (usually done in an .Rprofile file):

options(repos = c("path/to/internal/repo", getOption("repos")))