load: Load a project

View source: R/load.R

loadR Documentation

Load a project

Description

renv::load() sets the library paths to use a project-local library, sets up the system library sandbox, if needed, and creates shims for install.packages(), update.packages(), and remove.packages().

You should not generally need to call renv::load() yourself, as it's called automatically by the project auto-loader created by init()/ activate(). However, if needed, you can use renv::load("<project>") to explicitly load an renv project located at a particular path.

Usage

load(project = NULL, quiet = FALSE, profile = NULL, ...)

Arguments

project

The project directory. If NULL, then the active project will be used. If no project is currently active, then the current working directory is used instead.

quiet

Boolean; be quiet during load?

profile

The profile to be activated. See vignette("profiles", package = "renv") for more information. When NULL (the default), the profile is not changed. Use profile = "default" to revert to the default renv profile.

...

Unused arguments, reserved for future expansion. If any arguments are matched to ..., renv will signal an error.

Value

The project directory, invisibly. Note that this function is normally called for its side effects.

Shims

To help you take advantage of the package cache, renv places a couple of shims on the search path:

  • install.packages() instead calls renv::install().

  • remove.packages() instead calls renv::remove().

  • update.packages() instead calls renv::update().

This allows you to keep using your existing muscle memory for installing, updating, and remove packages, while taking advantage of renv features like the package cache.

If you'd like to bypass these shims within an R session, you can explicitly call the version of these functions from the utils package, e.g. with ⁠utils::install.packages(<...>)⁠.

If you'd prefer not to use the renv shims at all, they can be disabled by setting the R option options(renv.config.shims.enabled = FALSE) or by setting the environment variable RENV_CONFIG_SHIMS_ENABLED = FALSE. See ?config for more details.

Examples

## Not run: 

# load a project -- note that this is normally done automatically
# by the project's auto-loader, but calling this explicitly to
# load a particular project may be useful in some circumstances
renv::load()


## End(Not run)

rstudio/renv documentation built on Nov. 20, 2024, 7:34 a.m.