rv add
Used to quickly add packages to the config file and syncing.
The rv add command supports adding packages as simple dependencies or with advanced configuration options like specifying repositories, git sources, local paths, URLs, and various installation behaviors.
Using this command may feel similar to install.packages() in which packages can be iteratively added to the project,
just with the additional benefits provided by rv.
rv add [packages]... [OPTIONS]Arguments
Section titled “Arguments”packages- A list of packages to add to the project, given as separate arguments (e.g.rv add dplyr tidyr)
Options
Section titled “Options”General Options
Section titled “General 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 synced.
Package Source Options
Section titled “Package Source Options”--repository <ALIAS>- Specify which repository to install from (e.g.,cran,bioc). Creates a table entry with therepositoryfield.--git <URL>- Install from a git repository. Creates a table entry with thegitfield.--tag <TAG>- Specify a git tag (requires--git, conflicts with--commit/--branch)--branch <BRANCH>- Specify a git branch (requires--git, conflicts with--commit/--tag)--commit <SHA>- Specify a git commit SHA (requires--git, conflicts with--tag/--branch)--directory <DIR>- Specify subdirectory within git repo (requires--git)
--path <PATH>- Install from a local path. Creates a table entry with thepathfield.--url <URL>- Install from a URL to a package archive. Creates a table entry with theurlfield.
owner/repo shorthand
Section titled “owner/repo shorthand”As a shortcut for --git, a package argument in the form owner/repo is treated as a git source, resolved against https://github.com
(or git_shorthand_base_url if configured):
rv add r-lib/cli- installs from the repository’s default branchrv add r-lib/cli@v3.6.2- installs from a tag, branch, or commit SHA (auto-detected)rv add r-lib/cli@branch:main,@tag:v3.6.2, or@commit:9a8c5d2- explicitly typed referencerv add r-lib/usethis@tag:v2.2.3:r-package- reference plus a subdirectory within the repo
Installation Behavior Options
Section titled “Installation Behavior Options”--force-source- Forces the package to be fetched and installed as source from a repository. Addsforce_source = trueto the dependency entry.--install-suggestions- Install suggested packages. Addsinstall_suggestions = trueto the dependency entry.--dependencies-only- Install only the dependencies of the package, not the package itself. Addsdependencies_only = trueto the dependency entry. Useful when developing a package locally.
Examples
Section titled “Examples”A number of examples demonstrating the various options and capabilities of rv add are shown in the Cookbook section.