Debian Codegraph @

man/retrieve.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/retrieve.R
3 \name{retrieve}
4 \alias{retrieve}
5 \title{Retrieve packages}
6 \usage{
7 retrieve(packages = NULL, ..., lockfile = NULL, destdir = NULL, project = NULL)
8 }
9 \arguments{
10 \item{packages}{Either \code{NULL} (the default) to install all packages required
11 by the project, or a character vector of packages to install. renv
12 supports a subset of the remotes syntax used for package installation,
13 e.g:
14 \itemize{
15 \item \code{pkg}: install latest version of \code{pkg} from CRAN.
16 \item \code{pkg@version}: install specified version of \code{pkg} from CRAN.
17 \item \code{username/repo}: install package from GitHub.
18 \item \code{username/repo@ref}: install from a specific git ref (branch, tag, or SHA).
19 \item \code{username/repo:subdir}: install from a subdirectory of a GitHub repo.
20 \item \code{bioc::pkg}: install \code{pkg} from Bioconductor.
21 }
22
23 See \url{https://remotes.r-lib.org/articles/dependencies.html} and the examples
24 below for more details.
25
26 Note that renv deviates from the remotes spec in one important way:
27 subdirectories are separated from the repository specification with a \code{:}
28 rather than \code{/}. For example, to install from the \code{subdir} subdirectory
29 of GitHub package \code{username/repo}, you would use:
30
31 \if{html}{\out{<div class="sourceCode">}}\preformatted{renv::install("username/repo:subdir")
32 }\if{html}{\out{</div>}}}
33
34 \item{...}{Unused arguments, reserved for future expansion. If any arguments
35 are matched to \code{...}, renv will signal an error.}
36
37 \item{lockfile}{The path to an \code{renv} lockfile. When set, \code{renv}
38 will retrieve the packages as defined within that lockfile.
39 If \code{packages} is also non-\code{NULL}, then only those packages will
40 be retrieved.}
41
42 \item{destdir}{The directory where packages should be downloaded.
43 When \code{NULL} (the default), the default internal storage locations
44 (normally used by e.g. \code{\link[=install]{install()}} or \code{\link[=restore]{restore()}}) will
45 be used.}
46
47 \item{project}{The project directory. If \code{NULL}, then the active project will
48 be used. If no project is currently active, then the current working
49 directory is used instead.}
50 }
51 \value{
52 A named vector, mapping package names to the paths where
53 those packages were downloaded.
54 }
55 \description{
56 Retrieve (download) one or more packages from external sources.
57 Using \code{renv::retrieve()} can be useful in CI / CD workflows, where
58 you might want to download all packages listed in a lockfile
59 before later invoking \code{\link[=restore]{restore()}}. Packages will be downloaded
60 to an internal path within \code{renv}'s local state directories -- see
61 \link{paths} for more details.
62 }
63 \details{
64 If \code{destdir} is \code{NULL} and the requested package is already available
65 within the \code{renv} cache, \code{renv} will return the path to that package
66 directory in the cache.
67 }
68 \examples{
69 \dontrun{
70
71 # retrieve package + versions as defined in the lockfile
72 # normally used as a pre-flight step to renv::restore()
73 renv::retrieve()
74
75 # download one or more packages locally
76 renv::retrieve("rlang", destdir = ".")
77
78 }
79 }