Skip to content

Latest commit

 

History

History
194 lines (123 loc) · 5.13 KB

COMMANDS.md

File metadata and controls

194 lines (123 loc) · 5.13 KB

Command Reference

Like git, the renv command delegates to subcommands based on its first argument.

The most common subcommands are:

renv commands

Lists all available renv commands.

renv local

Sets a local application-specific R version by writing the version name to a .R-version file in the current directory. This version overrides the global version, and can be overridden itself by setting the RENV_VERSION environment variable or with the renv shell command.

$ renv local 3.0.0

When run without a version number, renv local reports the currently configured local version. You can also unset the local version:

$ renv local --unset

Previous versions of renv stored local version specifications in a file named .renv-version. For backwards compatibility, renv will read a local version specified in an .renv-version file, but a .R-version file in the same directory will take precedence.

renv global

Sets the global version of R to be used in all shells by writing the version name to the ~/.renv/version file. This version can be overridden by an application-specific .R-version file, or by setting the RENV_VERSION environment variable.

$ renv global 3.0.0

The special version name system tells renv to use the system R (detected by searching your $PATH).

When run without a version number, renv global reports the currently configured global version.

renv shell

Sets a shell-specific R version by setting the RENV_VERSION environment variable in your shell. This version overrides application-specific versions and the global version.

$ renv shell 3.2.1

When run without a version number, renv shell reports the current value of RENV_VERSION. You can also unset the shell version:

$ renv shell --unset

Note that you'll need renv's shell integration enabled (step 3 of the installation instructions) in order to use this command. If you prefer not to use shell integration, you may simply set the RENV_VERSION variable yourself:

$ export RENV_VERSION=3.2.1

renv install

Install an R version (using R-build).

Usage: renv install [-f] [-kvp] <version>
       renv install [-f] [-kvp] <definition-file>
       renv install -l|--list

  -l/--list             List all available versions
  -f/--force            Install even if the version appears to be installed already
  -s/--skip-existing    Skip the installation if the version appears to be installed already

  R-build options:

  -k/--keep        Keep source tree in $RENV_BUILD_ROOT after installation
                   (defaults to $RENV_ROOT/sources)
  -v/--verbose     Verbose mode: print compilation status to stdout
  -p/--patch       Apply a patch from stdin before building
  -g/--debug       Build a debug version

To list the all available versions of R:

$ renv install --list

Then install the desired versions:

$ renv install 3.0.0
$ renv install 3.2.4
$ renv versions
  system
  * 3.0.0 (set by /home/yyuu/.renv/version)
  3.2.4

renv uninstall

Uninstall a specific R version.

Usage: renv uninstall [-f|--force] <version>

   -f  Attempt to remove the specified version without prompting
       for confirmation. If the version does not exist, do not
       display an error message.

renv sync

Installs all packages specified in renv.lock file.

Usage: renv sync

renv update-rstudio-launcher

Updates the RStudio launcher file.

Usage: renv update-rstudio-launcher

Updates the RStudio launcher file, to allow executing RStudio with different R installed versions. Note: it creates a .desktop file, so it is currently working only with GNOME-based launchers.

renv rehash

Installs shims for all R binaries known to renv (i.e., ~/.renv/versions/*/bin/*). Run this command after you install a new version of R, or install a package that provides binaries.

$ renv rehash

renv version

Displays the currently active R version, along with information on how it was set.

$ renv version
3.0.0 (set by /home/yyuu/.renv/version)

renv versions

Lists all R versions known to renv, and shows an asterisk next to the currently active version.

$ renv versions
* 3.0.0 (set by /home/yyuu/.renv/version)
  3.2.1
  3.2.4
  3.3.3
  3.5.3

renv which

Displays the full path to the executable that renv will invoke when you run the given command.

$ renv which R
/home/yyuu/.renv/versions/3.3.3/bin/R

renv whence

Lists all R versions with the given command installed.

$ renv whence R
3.0.0
3.2.4
3.3.3