r_version
The R version to install packages for, containing at least the major and minor versions.
Finding the Executable
Section titled “Finding the Executable”The R version is found on the system according to the following guidelines:
Version Matching
Section titled “Version Matching”rv utilizes a flexible version matching approach, similar to Posit Connect’s major-minor approach.
If the patch version is specified, it will perform an exact match. If the patch version is not specified, it will match to any R version found
with the same major and minor version.
For example, if R 4.5.0 and 4.5.1 are found on the system, the following matches will occur:
r_version = "4.5"→4.5.0and4.5.1r_version = "4.5.0"→4.5.0
Since R packages are compatible across patch versions of R, it is recommended to specify only the major and minor version to increase cross-system compatibility.
Known Binary Locations
Section titled “Known Binary Locations”rv looks for an R matching the r_version of the project in the following order.
-
The
Rfound on thePATH, if its version matches -
The versioned links
rigputs on thePATHrv v0.23.0, named after the version they point at:R-4.5, sometimes suffixed with-arm64/-x86_64, on macOS,R-4.5.1on Linux andR-4.5.1.exeorR-4.5.1.baton Windows. -
The known installation locations of each OS:
- Linux - the subdirectories of
/opt/R(i.e./opt/R/4.5.0/bin/R) - macOS -
/Library/Frameworks/R.framework/Versions/*(the layout used by the CRAN installer) and/opt/homebrew/Cellar/r/*(Apple Silicon Homebrew installs). Intel Homebrew’s/usr/local/Cellar/ris not scanned. - Windows - the subdirectories of
C:\Program Files\Rand of%LOCALAPPDATA%\Programs\R
Those installations do not need to be on the
PATH:rvreads their version from theRversion.hheader they ship. - Linux - the subdirectories of
-
rig list --jsonrv v0.23.0, ifrigis on thePATHbut none of its installs were found by the steps above.
Overriding the R version
Section titled “Overriding the R version”The commands that need to know which R to use take flags to override the discovery described above. Both have an
environment variable equivalent, RV_R_BIN and
RV_R_VERSION.
--r-bin <PATH>- Use the R at that path instead of looking for one. Its version has to match ther_versionof the project, otherwiserverrors and tells you what to pass to run with it anyway--r-version <VERSION>- The R version to use. On its own it can only ask for a version matching the project’sr_version, unless the command never runs R. Together with--r-bin, it asserts the version of that R and allows it to differ from the project
Running against an R that does not match the project is therefore a deliberate two step opt-in: --r-bin alone will not
do it, since a wrong path should not quietly install packages for another R version.
What that means per command:
| Commands | Overriding |
|---|---|
rv plan, rv summary, rv tree, rv library | Those never run R, so --r-version alone is enough to see what the project would look like on another R version, even one that is not installed |
rv sync, rv run | --r-bin together with --r-version runs against an R that differs from the project. The lockfile is then neither read nor updated, and rv warns about it |
rv add, rv remove, rv upgrade | Only take --r-bin, and its version has to match the project. Those commands write the lockfile, so running them against another R is an error |
use_devel
Section titled “use_devel”If you are running an R-devel build (identified by a non-empty status field in R’s Rversion.h), set use_devel = true alongside
r_version so rv matches against that devel installation instead of a released version with the same major/minor version.
[project]name = "devel project"r_version = "4.6"use_devel = truerepositories = [ { alias = "PPM", url = "https://packagemanager.posit.co/cran/latest" },]dependencies = [ "dplyr",]Default:
false