Chapter 2 R Patched and Development Versions
These instructions cover how to install R from source or from binaries. Contributors will typically need to work with the patched or development versions of R. This chapter describes where the source code for these versions can be found and how to install these versions from the source or the binary builds (where available). The tools required to build R and R packages are also discussed. For the most up to date and complete instructions you can check the R installation and administration manual .
2.1 The R source code
R uses svn as a version control tool hosted at https://svn.r-project.org/R/ and uses a ‘major.minor.patchlevel’ version numbering scheme2.
There are three releases of R available to install:
The latest official release (
r-release
), either major version x.0.0 or minor version x.y.0, for example: 3.0.0 or 3.2.0The patched release (
r-patched
), for example 3.0.1 or 3.2.1 andThe development release (
r-devel
) : continually developed version moving from r-release to next major/minor version (x + 1).0.0 or x.(y + 1).0 a few weeks before release (at the start of the “GRAND FEATURE FREEZE”).
The source code of released versions of R can be found at R/tags, the patched versions are at R/branch.
The r-devel
at R/trunk is the next minor or eventual major release development version of R.
Bug fixes and new features are introduced in r-devel
first.
If the change meets the development guidelines R Core will also make the change in r-patched
.
2.2 Prerequisites
To install from the source code you will need the source code and the dependencies of R.
If you need to install svn you can use your distribution’s package manager to install it.
2.2.1 Ubuntu
In Ubuntu you can use this command to find all the dependencies of R:
apt-rdepends --build-depends --follow=DEPENDS r-base-dev | grep " B" | sed -e "s/ Build-Depends: //"
It might require installation of apt-rdepends which can be done from default repositories via sudo apt-get install apt-rdepends
.
To install all the R dependencies you can use:
2.3 Building R
It is recommended to build R in a different path than the source.
For this reason we have a TOP_SRCDIR
variable where the source code goes and the variable BUILDDIR
where the built R version will go.
2.3.1 Linux
Here are the basic steps intended as a checklist. For complete instructions please see the section in R-admin.
Retrieve R source code via into
TOP_SRCDIR
, note that we retrieve ther-devel
source code:Download the latest recommended packages3:
Create the build directory in the
BUILDDIR
:Configure the R installation (with
--enable-R-shlib
so that RStudio IDE can use it):Build R :
Check that R works as expected:
There are other checks you can run:
If we don’t want to build R in a different directory than the source code we can simply use:
cd "$TOP_SRCDIR"
svn update
tools/rsync-recommended
"$TOP_SRCDIR/configure" --enable-R-shlib
make
make check
Once you successfully built R from source you can modify the R source code to fix an issue: Prepare a patch (See this guide) and after checking that R works as intended (make check-devel
) submit the patch for consideration by R Core.
(See the lifecycle of a patch chapter).
To use the r-devel
version in RStudio, you can do the following:
2.3.2 Windows
2.3.2.1 Binaries
The binary builds of R for Windows can be downloaded and installed from here.
Along with the link to the latest stable release, this page also contains links to the binary builds of r-patched
and r-devel
.
Click on the download links to download an executable installer.
Select the language while installing, read the GNU general public license information, and select the destination location to start the installation. You will be prompted to select components at this stage:
User installation
,64-bit User installation
, orCustom installation
. The default option may be chosen for the questions from this step onwards to complete the installation.
Daily binaries for r-devel
are made available for download and installation.
2.3.2.2 From source
Before installing R from source, some additional programs are needed, as per the latest documentation:
Rtools is the suggested toolchain bundle for building R base and R packages containing compiled code on Windows. The latest version of Rtools can be installed using the Rtools installer rtools44-XXXX-XXX.exe.
A LaTeX compiler is needed to install and build R, check packages and build manuals. On CRAN, MiKTeX is used, which can be downloaded from https://miktex.org. Once installed open MiKTeX via the Windows start menu. It might ask to check for updates and more importantly, to make it available in PATH. You can accept both.
Open the Rtools44 terminal to update and install subversion:
Retrieve the latest source code via subversion:
If you already have the repository available you can update as:
You can also use a SVN client such as TortoiseSVN (https://tortoisesvn.net/, command line tool, and Windows Explorer integration) or SlikSVN (https://sliksvn.com/download/, just the command line tool) so that it can be also found by other tools.
Download the latest tcl/tk and unzip it in
$TOP_SRCDIR
:Add gcc, MiKTeX and tar to the PATH and set one tar option:
export PATH="/x86_64-w64-mingw32.static.posix/bin:$PATH" export PATH="/c/Program Files/MiKTeX/miktex/bin/x64:$PATH" export TAR="/usr/bin/tar" export TAR_OPTIONS="--force-local"
If MiKTeX was installed just for your user you might need to run:
Check that all the programs can be found:
If there is any error you’ll need to find where the program is installed and add the corresponding path.
Download the latest recommended packages4:
Build R and the recommended packages:
The recently compiled version of R will be at
$TOP_SRCDIR/bin/
. In RStudio you can select that folder and restart it to use ther-devel
version.Check that R works as expected:
There are other checks you can run for testing the successful installation of the recommended packages:
2.3.3 macOS
This section will be added after the official installation instructions for macOS in the R installation and administration manual have been updated for R 4.4.0.
Also known as semantic versioning↩︎
Recommended packages are not in the subversion repository.↩︎
Recommended packages are not in the subversion repository.↩︎