init_renv: Initialize renv infrastructure (cynkra way)

View source: R/renv.R

init_renvR Documentation

Initialize renv infrastructure (cynkra way)

Description

[Experimental]

Initializes renv setup by setting a predefined RStudio Package Manager (RSPM) snapshot. Custom RSPM Snapshots can be configured via snapshot_date.

Usage

init_renv(snapshot_date = NULL, exclude = NULL, convenience_pkgs = FALSE)

Arguments

snapshot_date

⁠[Date]⁠
A valid RSPM snapshot date. By default the "recommended" date from get_snapshots() for the respective R version is chosen.

exclude

⁠[character]⁠
Packages to exclude from renv::install(). Useful if a package is not available in the available repositories (check with ⁠getOption("repos"⁠) to prevent init_renv() to fail. This should only be a temporary workaround - consider making local packages available in a minicran-like repository.

convenience_pkgs

⁠[logical]⁠
Install additional opinionated convenience packages? The following packages would be installed:

  • usethis

  • styler

  • gert

  • krlmlr/fledge

Details

During the process, the latest CRAN version of renv will be installed, regardless of the chosen snapshot ID.

The heuristic for setting the correct RSPM binary repo currently only supports Windows, macOS and Ubuntu 20.04.

The initialization mostly runs in clean vanilla sessions started with callr::r_vanilla().

Examples

## Not run: 
init_renv()

## End(Not run)

cynkra/cynkrathis documentation built on June 14, 2025, 4:26 p.m.