Learn R Programming

renv (version 0.17.3)

vendor: Vendor renv in an R Package

Description

Vendor a copy of renv in an R package.

Usage

vendor(
  version = NULL,
  repository = "https://github.com/rstudio/renv",
  sources = NULL,
  project = getwd()
)

Arguments

version

The version of renv to vendor. If NULL (the default), the current version of renv will be used. Ignored if sources is non-NULL.

repository

The Git repository from which renv should be retrieved. renv will use git clone <repository> --branch <version> to download the required renv sources. Ignored if sources is non-NULL.

sources

The path to local renv sources to be vendored.

project

The project in which renv should be vendored.

Details

Calling renv::vendor() will:

  • Compile a vendored copy of renv to inst/vendor/renv.R,

  • Generate an renv auto-loader at R/renv.R.

Using this, projects can take a dependency on renv, and use renv internals, in a CRAN-compliant way. After vendoring renv, you can use renv APIs in your package via the embedded renv environment; for example, you could call the dependencies() function with:

renv$dependencies()

Be aware that renv internals might change in future releases, so if you need to rely on renv internal functions, we strongly recommend testing your usages of these functions to avoid potential breakage.