Skip to content

rv add

Used to quickly add packages to the config file, then sync.

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.

Terminal window
rv add [packages]... [OPTIONS]
  • packages - A list of packages, space or comma separated, to add to the project
  • --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.
  • --repository <ALIAS> - Specify which repository to install from (e.g., cran, bioc). Creates a table entry with the repository field.
  • --git <URL> - Install from a git repository. Creates a table entry with the git field.
    • --tag <TAG> - Specify a git tag (requires --git)
    • --branch <BRANCH> - Specify a git branch (requires --git)
    • --directory <DIR> - Specify subdirectory within git repo (requires --git)
  • --path <PATH> - Install from a local path. Creates a table entry with the path field.
  • --url <URL> - Install from a URL to a package archive. Creates a table entry with the url field.
  • --force-source - Forces the package to be fetched and installed as source from a repository. Adds force_source = true to the dependency entry.
  • --install-suggestions - Install suggested packages. Adds install_suggestions = true to the dependency entry.
  • --dependencies-only - Install only the dependencies of the package, not the package itself. Adds dependencies_only = true to the dependency entry. Useful when developing a package locally.

A number of examples demonstrating the various options and capabilities of rv add are shown in the Cookbook section.