Debian Codegraph @

man/checkout.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/checkout.R
3 \name{checkout}
4 \alias{checkout}
5 \title{Checkout a repository}
6 \usage{
7 checkout(
8 repos = NULL,
9 ...,
10 packages = NULL,
11 date = NULL,
12 clean = FALSE,
13 actions = "restore",
14 dependencies = NULL,
15 restart = NULL,
16 project = NULL
17 )
18 }
19 \arguments{
20 \item{repos}{The \R package repositories to use.}
21
22 \item{...}{Unused arguments, reserved for future expansion. If any arguments
23 are matched to \code{...}, renv will signal an error.}
24
25 \item{packages}{The packages to be installed. When \code{NULL} (the default),
26 all packages currently used in the project will be installed, as
27 determined by \code{\link[=dependencies]{dependencies()}}. The recursive dependencies of these
28 packages will be included as well.}
29
30 \item{date}{The snapshot date to use. When set, the associated snapshot as
31 available from the Posit's public
32 \href{https://packagemanager.rstudio.com/}{Package Manager} instance will be
33 used. Ignored if \code{repos} is non-\code{NULL}.}
34
35 \item{clean}{Boolean; remove packages not recorded in the lockfile from
36 the target library? Use \code{clean = TRUE} if you'd like the library state
37 to exactly reflect the lockfile contents after \code{restore()}.}
38
39 \item{actions}{The action(s) to perform with the requested repositories.
40 This can either be \code{"snapshot"}, in which \code{renv} will generate a lockfile
41 based on the latest versions of the packages available from \code{repos}, or
42 \code{"restore"} if you'd like to install those packages. You can use
43 \code{c("snapshot", "restore")} if you'd like to generate a lockfile and
44 install those packages in a single call. When \code{actions} contains
45 \code{"snapshot"}, the lockfile is generated from repository metadata
46 (the \code{PACKAGES} file) without installing packages, so it may contain
47 only a subset of the fields present in a lockfile generated by
48 \code{\link[=snapshot]{snapshot()}}.}
49
50 \item{dependencies}{A vector of DESCRIPTION field names that should be used
51 for package dependency resolution. When \code{NULL} (the default), the value
52 of \code{renv::settings$package.dependency.fields} is used. The aliases
53 "strong", "most", and "all" are also supported.
54 See \code{\link[tools:package_dependencies]{tools::package_dependencies()}} for more details.}
55
56 \item{restart}{Should the \R session be restarted after the new
57 packages have been checked out? When \code{NULL} (the default), the
58 session is restarted if the \code{"restore"} action was taken.}
59
60 \item{project}{The project directory. If \code{NULL}, then the active project will
61 be used. If no project is currently active, then the current working
62 directory is used instead.}
63 }
64 \description{
65 \code{renv::checkout()} can be used to retrieve the latest-available packages from
66 a (set of) package repositories.
67 }
68 \details{
69 \code{renv::checkout()} is most useful with services like the Posit's
70 \href{https://packagemanager.rstudio.com/}{Package Manager}, as it
71 can be used to switch between different repository snapshots within an
72 renv project. In this way, you can upgrade (or downgrade) all of the
73 packages used in a particular renv project to the package versions
74 provided by a particular snapshot.
75
76 Note that calling \code{renv::checkout()} will also install the version of \code{renv}
77 available as of the requested snapshot date, which might be older or lack
78 features available in the currently-installed version of \code{renv}. In addition,
79 the project's \code{renv/activate.R} script will be re-generated after checkout.
80 If this is undesired, you can re-install a newer version of \code{renv} after
81 checkout from your regular \R package repository.
82 }
83 \section{Caveats}{
84
85
86 If your library contains packages installed from other remote sources (e.g.
87 GitHub), but a version of a package of the same name is provided by the
88 repositories being checked out, then please be aware that the package will be
89 replaced with the version provided by the requested repositories. This could
90 be a concern if your project uses \R packages from GitHub whose name matches
91 that of an existing CRAN package, but is otherwise unrelated to the package
92 on CRAN.
93 }
94
95 \examples{
96 \dontrun{
97
98 # check out packages from PPM using the date '2023-01-02'
99 renv::checkout(date = "2023-01-02")
100
101 # alternatively, supply the full repository path
102 renv::checkout(repos = c(PPM = "https://packagemanager.rstudio.com/cran/2023-01-02"))
103
104 # only check out some subset of packages (and their recursive dependencies)
105 renv::checkout(packages = "dplyr", date = "2023-01-02")
106
107 # generate a lockfile based on a snapshot date
108 renv::checkout(date = "2023-01-02", actions = "snapshot")
109
110 }
111 }