Retrieve (download) one or more packages from external sources.
Using renv::retrieve()
can be useful in CI / CD workflows, where
you might want to download all packages listed in a lockfile
before later invoking restore()
. Packages will be downloaded
to an internal path within renv
's local state directories – see
paths for more details.
Arguments
- packages
Either
NULL
(the default) to install all packages required by the project, or a character vector of packages to install. renv supports a subset of the remotes syntax used for package installation, e.g:pkg
: install latest version ofpkg
from CRAN.pkg@version
: install specified version ofpkg
from CRAN.username/repo
: install package from GitHubbioc::pkg
: installpkg
from Bioconductor.
See https://remotes.r-lib.org/articles/dependencies.html and the examples below for more details.
renv deviates from the remotes spec in one important way: subdirectories are separated from the main repository specification with a
:
, not/
. So to install from thesubdir
subdirectory of GitHub packageusername/repo
you'd use"username/repo:subdir
.- ...
Unused arguments, reserved for future expansion. If any arguments are matched to
...
, renv will signal an error.- lockfile
The path to an
renv
lockfile. When set,renv
will retrieve the packages as defined within that lockfile. Ifpackages
is also non-NULL
, then only those packages will be retrieved.- destdir
The directory where packages should be downloaded. When
NULL
(the default), the default internal storage locations (normally used by e.g.install()
orrestore()
) will be used.- 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.