Discover the R packages used within a project, and then install those packages into the active library. This effectively allows you to clone the state of your system R libraries for use within a project library.
hydrate(packages = NULL, project = NULL, library = NULL,
missing = NULL)
The set of R packages to install. When NULL
, the
set of packages as reported by dependencies()
is used.
The project directory. If NULL
, then the active
project will be used. If no project has been specifically activated,
the current working directory is used.
The R library to be hydrated. When NULL
, the active
library as reported by .libPaths()
is used.
The behavior to choose when one or more of the requested packages are not available on the system. See Missing Packages for more details.
The missing
argument controls what happens when your project requests the
hydration of packages which are not currently installed on your system. The
possible values are:
Option | Action |
"install" |
Install the latest version of missing packages from CRAN. |
"ignore" |
Do nothing; missing packages will not be installed. |
The R option renv.hydrate.missing
can be used to control the default behavior
of renv::hydrate()
.
hydrate()
attempts to re-use packages already installed on your system, to
avoid unnecessary attempts to download and install packages from CRAN.
hydrate()
will attempt to discover R packages from the following sources
(in order):
The user library,
The site library,
The system library,
The renv
cache.
If package is discovered in one of these locations, renv
will attempt to
copy or link that package into the requested library as appropriate.