Working with dependencies in R

CRAN

Using the DESCRIPTION file

For R projects, Johnny analyzes the DESCRIPTION file, which contains package metadata and dependency lists in the Depends, Imports, Suggests, and LinkingTo sections.

Using the renv.lock file

The renv package is used to lock dependency versions:

  1. Initialize renv in the project:

    renv::init()
  2. Snapshot the dependency state:

    renv::snapshot()

A renv.lock file will be created, containing the locked versions of all dependencies.

Dependency resolution via renv

Johnny supports dependency resolution for R projects with the --rlang-resolve flag. Resolution is performed using Rscript, so it must be available in the environment (the path can be overridden with the --rscript-path flag).

Was this page helpful?