Upgrade the version of renv associated with a project, including using a development version from GitHub. Automatically snapshots the updated renv, updates the activate script, and restarts R.
If you want to update all packages (including renv) to their latest CRAN
versions, use update()
.
upgrade(project = NULL, version = NULL, reload = NULL, prompt = interactive())
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 version of renv to be installed.
When NULL
(the default), the latest version of renv will be installed as
available from CRAN (or whatever active package repositories are active)
Alternatively, you can install the latest development version with
"main"
, or a specific commit with a SHA, e.g. "5049cef8a"
.
Boolean; reload renv after install? When NULL
(the
default), renv will be re-loaded only if updating renv for the
active project. Since it's not possible to guarantee a clean reload
in the current session, this will attempt to restart your R session.
Boolean; prompt upgrade before proceeding?
A boolean value, indicating whether the requested version of renv was successfully installed. Note that this function is normally called for its side effects.
upgrade()
is expected to work for renv versions >= 1.0.1.
To upgrade from prior versions of renv, users should
renv::deactivate();
install.packages("renv");
renv::activate();
renv::record("renv")
if (FALSE) { # \dontrun{
# upgrade to the latest version of renv
renv::upgrade()
# upgrade to the latest version of renv on GitHub (development version)
renv::upgrade(version = "main")
} # }