Installing Packages
rv sync
Section titled “rv sync”In other R tools, individual packages are installed and removed through separate commands (i.e. install.packages()
and remove.packages()
)
In rv
, a project is sync
hronized across the config file, lock file, and the project library, performing whatever actions,
including installation and removal of packages and dependencies, is necessary to reach the synchronized state.
Therefore, package(s) installation is called sync
in rv
.
Every time a package is changed - added, removed, new version, source changed - the lockfile is automatically updated to reflect the new state of the project library.
rv sync [OPTIONS]
Example
Section titled “Example”[project]name = "my project"r_version = "4.4"
repositories = [ { alias = "PPM", url = "https://packagemanager.posit.co/cran/latest" }]
dependencies = [ "tibble",]
rv sync
installs the tibble
package and all of its dependencies, indicating which version, from where, and
the time it took for each installed package.
$ rv sync+ cli (3.6.5, binary from https://packagemanager.posit.co/cran/latest) in 1ms+ fansi (1.0.6, binary from https://packagemanager.posit.co/cran/latest) in 1ms+ glue (1.8.0, binary from https://packagemanager.posit.co/cran/latest) in 1ms+ lifecycle (1.0.4, binary from https://packagemanager.posit.co/cran/latest) in 0ms+ magrittr (2.0.3, binary from https://packagemanager.posit.co/cran/latest) in 0ms+ pillar (1.10.2, binary from https://packagemanager.posit.co/cran/latest) in 0ms+ pkgconfig (2.0.3, binary from https://packagemanager.posit.co/cran/latest) in 0ms+ rlang (1.1.6, binary from https://packagemanager.posit.co/cran/latest) in 1ms+ tibble (3.2.1, binary from https://packagemanager.posit.co/cran/latest) in 0ms+ utf8 (1.2.5, binary from https://packagemanager.posit.co/cran/latest) in 0ms+ vctrs (0.6.5, binary from https://packagemanager.posit.co/cran/latest) in 0ms
Directorymy-project
Directoryrv/
Directoryscripts/
- …
Directorylibrary/4.4/{arch}/ the installed packages
- cli
- fansi
- glue
- lifecycle
- magrittr
- pillar
- pkgconfig
- rlang
- tibble
- utf8
- vctrs
- rproject.toml
- rv.lock an
rv.lock
file generated to track the package’s sources
rv add
Section titled “rv add”For quick editing and installation, rv add pkg1 pkg2...
can be used to add these packages as dependencies to the config file
and then sync
. Currently, rv
only adds packages as simple dependencies.
To add packages with additional options, the config file is intended to be edited and then run rv sync
.
Using this command may feel similar to install.packages()
where packages can be iteratively added to the project,
just with the additional benefit of rv
.
rv add [OPTIONS] [packages]...
Arguments
Section titled “Arguments”packages
- A list of packages, space separated, to add to the project
Options
Section titled “Options”--dry-run
- No changes made to the config or the package library, only reports what would happen if the command was run.--no-sync
- Packages are added to the config file, but not sync’ed.
Example
Section titled “Example”[project]name = "my project"r_version = "4.4"
repositories = [ { alias = "PPM", url = "https://packagemanager.posit.co/cran/latest" }]
dependencies = [ "tibble",]
$rv add dplyr+ dplyr (1.1.4, binary from https://packagemanager.posit.co/cran/latest) in 1ms+ generics (0.1.4, binary from https://packagemanager.posit.co/cran/latest) in 1ms+ R6 (2.6.1, binary from https://packagemanager.posit.co/cran/latest) in 1ms+ tidyselect (1.2.1, binary from https://packagemanager.posit.co/cran/latest) in 0ms+ withr (3.0.2, binary from https://packagemanager.posit.co/cran/latest) in 3ms
[project]name = "my project"r_version = "4.4"
repositories = [ { alias = "PPM", url = "https://packagemanager.posit.co/cran/latest" }]
dependencies = [ "tibble", "dplyr",]
rv upgrade
Section titled “rv upgrade”rv
will default to installing packages from the source they are locked in, as long as that source is still within the configuration file,
as discussed in the Resolution Reference.
rv upgrade
will ignore the lockfile, re-resolve, and install any changed packages.
This does not necessarily upgrade to the latest version available across repositories, nor guarantee the packages will
be sourced from a the same repository. Rather, your project state will be set as if there was no lockfile present.
Usage:
Section titled “Usage:”rv upgrade [OPTIONS]
Options
Section titled “Options”--dry-run
- No changes made, only reports what would happen if the command was run.