Debian Codegraph @

man/install.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/install.R
3 \name{install}
4 \alias{install}
5 \title{Install packages}
6 \usage{
7 install(
8 packages = NULL,
9 ...,
10 include = NULL,
11 exclude = NULL,
12 library = NULL,
13 type = NULL,
14 rebuild = FALSE,
15 repos = NULL,
16 prompt = interactive(),
17 dependencies = NULL,
18 verbose = NULL,
19 transactional = NULL,
20 lock = FALSE,
21 project = NULL
22 )
23 }
24 \arguments{
25 \item{packages}{Either \code{NULL} (the default) to install all packages required
26 by the project, or a character vector of packages to install. renv
27 supports a subset of the remotes syntax used for package installation,
28 e.g:
29 \itemize{
30 \item \code{pkg}: install latest version of \code{pkg} from CRAN.
31 \item \code{pkg@version}: install specified version of \code{pkg} from CRAN.
32 \item \code{username/repo}: install package from GitHub.
33 \item \code{username/repo@ref}: install from a specific git ref (branch, tag, or SHA).
34 \item \code{username/repo:subdir}: install from a subdirectory of a GitHub repo.
35 \item \code{bioc::pkg}: install \code{pkg} from Bioconductor.
36 }
37
38 See \url{https://remotes.r-lib.org/articles/dependencies.html} and the examples
39 below for more details.
40
41 Note that renv deviates from the remotes spec in one important way:
42 subdirectories are separated from the repository specification with a \code{:}
43 rather than \code{/}. For example, to install from the \code{subdir} subdirectory
44 of GitHub package \code{username/repo}, you would use:
45
46 \if{html}{\out{<div class="sourceCode">}}\preformatted{renv::install("username/repo:subdir")
47 }\if{html}{\out{</div>}}}
48
49 \item{...}{Unused arguments, reserved for future expansion. If any arguments
50 are matched to \code{...}, renv will signal an error.}
51
52 \item{include}{Packages which should be installed. \code{include} can
53 occasionally be useful when you'd like to call \code{renv::install()} with
54 no arguments, but restrict package installation to only some subset
55 of dependencies in the project.}
56
57 \item{exclude}{Packages which should not be installed. \code{exclude} is useful
58 when using \code{renv::install()} to install all dependencies in a project,
59 except for a specific set of packages.}
60
61 \item{library}{The \R library to be used. When \code{NULL}, the active project
62 library will be used instead.}
63
64 \item{type}{The type of package to install ("source" or "binary"). Defaults
65 to the value of \code{getOption("pkgType")}.}
66
67 \item{rebuild}{Force packages to be rebuilt, thereby bypassing any installed
68 versions of the package available in the cache? This can either be a
69 boolean (indicating that all installed packages should be rebuilt), or a
70 vector of package names indicating which packages should be rebuilt.}
71
72 \item{repos}{The repositories to use when restoring packages installed
73 from CRAN or a CRAN-like repository. By default, the repositories recorded
74 in the lockfile will be used, ensuring that (e.g.) CRAN packages are
75 re-installed from the same CRAN mirror.
76
77 Use \code{repos = getOption("repos")} to override with the repositories set
78 in the current session, or see the \code{repos.override} option in \link{config} for
79 an alternate way override.}
80
81 \item{prompt}{Boolean; prompt the user before taking any action? For backwards
82 compatibility, \code{confirm} is accepted as an alias for \code{prompt}.}
83
84 \item{dependencies}{A vector of DESCRIPTION field names that should be used
85 for package dependency resolution. When \code{NULL} (the default), the value
86 of \code{renv::settings$package.dependency.fields} is used. The aliases
87 "strong", "most", and "all" are also supported.
88 See \code{\link[tools:package_dependencies]{tools::package_dependencies()}} for more details.}
89
90 \item{verbose}{Boolean; report output from \verb{R CMD build} and \verb{R CMD INSTALL}
91 during installation? When \code{NULL} (the default), the value of \code{config$install.verbose()}
92 will be used. When \code{FALSE}, installation output will be emitted only if
93 a package fails to install.}
94
95 \item{transactional}{Whether or not to use a 'transactional' package
96 installation. See \strong{Transactional Restore} in \code{\link[=restore]{restore()}} for
97 more details. When \code{NULL} (the default), the value of the
98 \code{install.transactional} \code{\link{config}} option will be used.}
99
100 \item{lock}{Boolean; update the \code{renv.lock} lockfile after the successful
101 installation of the requested packages?}
102
103 \item{project}{The project directory. If \code{NULL}, then the active project will
104 be used. If no project is currently active, then the current working
105 directory is used instead.}
106 }
107 \value{
108 A named list of package records which were installed by renv.
109 }
110 \description{
111 Install one or more \R packages, from a variety of remote sources.
112 \code{install()} uses the same machinery as \code{\link[=restore]{restore()}} (i.e. it uses cached
113 packages where possible) but it does not respect the lockfile, instead
114 installing the latest versions available from CRAN.
115
116 See \code{vignette("package-install")} for more details.
117 }
118 \section{\code{Remotes}}{
119 \code{install()} (called without arguments) will respect the \code{Remotes} field
120 of the \code{DESCRIPTION} file (if present). This allows you to specify places
121 to install a package other than the latest version from CRAN.
122 See \url{https://remotes.r-lib.org/articles/dependencies.html} for details.
123
124 Remotes can optionally be prefixed with a package name and \code{=}, to
125 explicitly associate a package name with a remote specification. For
126 example:
127
128 \if{html}{\out{<div class="sourceCode">}}\preformatted{Remotes: mypkg=user/repo
129 }\if{html}{\out{</div>}}
130
131 This is most useful when the package name cannot be inferred from the
132 remote (e.g. when the repository name differs from the package name).
133 }
134
135 \section{Bioconductor}{
136 Packages from Bioconductor can be installed by using the \verb{bioc::} prefix.
137 For example,
138
139 \if{html}{\out{<div class="sourceCode">}}\preformatted{renv::install("bioc::Biobase")
140 }\if{html}{\out{</div>}}
141
142 will install the latest-available version of Biobase from Bioconductor.
143
144 renv depends on BiocManager (or, for older versions of \R, BiocInstaller)
145 for the installation of packages from Bioconductor. If these packages are
146 not available, renv will attempt to automatically install them before
147 fulfilling the installation request.
148 }
149
150 \examples{
151 \dontrun{
152
153 # install the latest version of 'digest'
154 renv::install("digest")
155
156 # install an old version of 'digest' (using archives)
157 renv::install("[email protected]")
158
159 # install 'digest' from GitHub (latest dev. version)
160 renv::install("eddelbuettel/digest")
161
162 # install a package from GitHub, using specific commit
163 renv::install("eddelbuettel/digest@df55b00bff33e945246eff2586717452e635032f")
164
165 # install a package from Bioconductor
166 # (note: requires the BiocManager package)
167 renv::install("bioc::Biobase")
168
169 # install a package from a subdirectory of a GitHub repo
170 renv::install("username/repo:subdir")
171
172 # install a package, specifying path explicitly
173 renv::install("~/path/to/package")
174
175 # install packages as declared in the project DESCRIPTION file
176 renv::install()
177
178 }
179 }