Dependency management in R

前端 未结 4 1182
野趣味
野趣味 2021-02-02 16:26

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, No

4条回答
  •  梦如初夏
    2021-02-02 17:00

    As a stop-gap, I've written a new rbundler package. It installs project dependencies into a project-specific subdirectory (e.g. /.Rbundle), allowing the user to avoid using global libraries.

    • rbundler on Github
    • rbundler on CRAN

    We've been using rbundler at Opower for a few months now and have seen a huge improvement in developer workflow, testability, and maintainability of internal packages. Combined with our internal package repository, we have been able to stabilize development of a dozen or so packages for use in production applications.

    A common workflow:

    • Check out a project from github
    • cd into the project directory
    • Fire up R
    • From the R console:

      library(rbundler)

      bundle('.')

    All dependencies will be installed into ./.Rbundle, and an .Renviron file will be created with the following contents:

    R_LIBS_USER='.Rbundle'
    

    Any R operations run from within this project directory will adhere to the project-speciic library and package dependencies. Note that, while this method uses the package DESCRIPTION to define dependencies, it needn't have an actual package structure. Thus, rbundler becomes a general tool for managing an R project, whether it be a simple script or a full-blown package.

提交回复
热议问题