rrenv

What does renv::activate() do?


I read here in the documentation that renv::activate() adds source("renv/init.R") to the project .Rprofile. However, my .Rprofile has source("renv/activate.R") in there instead, as created by RStudio.

Isn't this an error in de documentation? It does not make sense to call renv::init() every time you open an RStudio project, does it?


Solution

  • Thanks -- that is an error in the documentation, the script is indeed located at renv/activate.R.

    To clarify, the main job of renv::activate() (and the related function renv::deactivate()) is to just add or remove the renv auto-loader from the project .Rprofile, which ensures that newly-launched R sessions in that renv is automatically activated in that project (so that the project-local library is used, etc.)