setup_renv: Setup 'renv' to track a project

View source: R/dependency_management.r

setup_renvR Documentation

Setup renv to track a project

Description

This function will initialise renv in a project, both with specified packages and identified dependencies. If run on an untracked project, it will first initialise renv and restart R Studio. If run on a tracked project, it will install the identified packages into the project library, and update the lockfile. You can also use this function as a convenience wrapper to get renv to track a new package you want to add to the project.

Usage

setup_renv(starter_packs = c("sak", "renv"), search_for_deps = TRUE)

Arguments

starter_packs

character (default = c("sak", "renv")) a character vector of extra packages to install. renv will try to identify packages used in the project and install these too. You can specify the version of a package by using the following notation: ⁠pins@0.4.5⁠.

search_for_deps

(logical; default = TRUE) do you want renv to look through the project and try to identify packages to track?

Value

nothing, called for side effects

Examples

## Not run: 
# Start tracking a new project
setup_renv()
# renv installs and then restarts, and you need to run it again
# but lets track a specific version of `pins` too
setup_renv(starter_packs = c("sak", "rsconnect", "renv", "pins@0.4.5"))

# some time later, you realise you want to renv to track `zoo`
# this function can get renv to do that too
setup_renv("zoo")

## End(Not run)

baslat/sak documentation built on April 14, 2025, 4:14 p.m.