Activate a project, thereby loading it in the current session and also writing the infrastructure necessary to ensure the project is auto-loaded for newly-launched R sessions.

activate(project = NULL, 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. The profile to be activated. When NULL, the default profile is activated instead. See vignette("profiles", package = "renv") for more information.

## Value

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

## Details

Using activate() will:

1. Load the requested project via load(),

2. Add source("renv/init.R") to the project .Rprofile, thereby instructing newly-launched R sessions to automatically load the current project.

Normally, activate() is called as part of init() when a project is first initialized. However, activate() can be used to activate (or re-activate) an renv project -- for example, if the project was shared without the auto-loader included in the project .Rprofile, or because that project was previously deactivated (via deactivate()).

Other renv: deactivate()

## Examples

if (FALSE) {

# activate the current project
renv::activate()

# activate a separate project
renv::activate("~/projects/analysis")

}