Discover the R packages used within a project, and then install those packages into the active library. This effectively allows you to fork the state of your default R libraries for use within a project library.
Usage
hydrate(
packages = NULL,
...,
library = NULL,
update = FALSE,
sources = NULL,
project = NULL
)
Arguments
- packages
The set of R packages to install. When
NULL
, the set of packages as reported bydependencies()
is used.- ...
Unused arguments, reserved for future expansion. If any arguments are matched to
...
,renv
will signal an error.- library
The R library to be hydrated. When
NULL
, the active library as reported by.libPaths()
is used.- update
Boolean; should
hydrate()
attempt to update already-installed packages if the requested package is already installed in the project library? Set this to"all"
if you'd like all packages to be refreshed from the source library if possible.- sources
A set of library paths from which
renv
should attempt to draw packages. See Sources for more details.- 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.
Value
A named R list, giving the packages that were used for hydration as well as the set of packages which were not found.
Details
It may occasionally be useful to use renv::hydrate()
to update the packages
used within a project that has already been initialized. However, be warned
that it's possible that the packages pulled in may not actually be compatible
with the packages installed in the project library, so you should exercise
caution when doing so.
Sources
hydrate()
attempts to re-use packages already installed on your system,
to avoid unnecessary attempts to download and install packages from remote
sources. When NULL
(the default), 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.