Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependency management in R

Does R have a dependency management tool to facilitate project-specific dependencies? I'm looking for something akin to Java's maven, Ruby's bundler, Python's virtualenv, Node's npm, etc.

I'm aware of the "Depends" clause in the DESCRIPTION file, as well as the R_LIBS facility, but these don't seem to work in concert to provide a solution to some very common workflows.

I'd essentially like to be able to check out a project and run a single command to build and test the project. The command should install any required packages into a project-specific library without affecting the global R installation. E.g.:

my_project/.Rlibs/*
like image 601
yoni Avatar asked Oct 11 '11 17:10

yoni


People also ask

What is a dependency in R?

Dependencies are invitations for other people to break your package. — Josh Ulrich, private communication. Welcome to the seventeenth post in the relentlessly random R ravings series of posts, or R4 for short. Dependencies. A truly loaded topic.

Is there a package manager for R?

Package management built for R & PythonRStudio Package Manager is a repository management server to organize and centralize packages across your team, department, or entire organization.

What is RENV R?

renv is an R dependency manager. Use renv to make your projects more: Isolated: Each project gets its own library of R packages, so you can feel free to upgrade and change package versions in one project without worrying about breaking your other projects.


1 Answers

Unfortunately, Depends: within the DESCRIPTION: file is all you get for the following reasons:

  • R itself is reasonably cross-platform, but that means we need this to work across platforms and OSs
  • Encoding Depends: beyond R packages requires encoding the Depends in a portable manner across operating systems---good luck encoding even something simple such as 'a PNG graphics library' in a way that can be resolved unambiguously across systems
  • Windows does not have a package manager
  • AFAIK OS X does not have a package manager that mixes what Apple ships and what other Open Source projects provide
  • Even among Linux distributions, you do not get consistency: just take RStudio as an example which comes in two packages (which all provide their dependencies!) for RedHat/Fedora and Debian/Ubuntu

This is a hard problem.

like image 53
Dirk Eddelbuettel Avatar answered Oct 14 '22 23:10

Dirk Eddelbuettel