R packages for the base system have been part of the Debian distribution since 1997, thanks to Douglas Bates, and are diligently maintained by Dirk Eddelbuettel since 2001. R, as well as many add-on packages (from CRAN and others repositories) are available via the regular Debian distribution mechanisms. Hence, running
apt-cache search "^r-.*"
should get you started with a list of available packages.
With an appropriate entry in
(see below according to the branch of Debian used), the newest R
release including recommended packages can be installed using a
command sequence like
apt-get update apt-get install r-base r-base-dev
While updating your package lists you might get a warning about a missing key, telling you that the integrity of packages can not be verified. You can ignore this if you trust the CRAN servers and continue with the installation. Otherwise, please refer to the section on secure apt below.
You only need r-base-dev if you want to compile R packages yourself or other software depending on R (see section below on administration and maintenance). Be aware that you may also have to install build dependencies (typically -dev packages containing headers). The list r-sig-debian is a good place to ask if you run into problems.
You may want to install the automatically tuned Atlas or the multi-threaded OpenBlas library in order to get higher performance for linear algebra operations
apt-get install libatlas3-base
apt-get install libopenblas-base
The R packages part of the
r-recommended packages are installed into the
/usr/lib/R/library. These can be updated
using usual package maintenance tools like apt-get or aptitude.
The other R packages precompiled as Debian
r-cran-* are installed
apt-cache rdepends r-base-core
shows all packages that depend on
comprises a large number of contributed packages from CRAN and
If you want to install R packages not provided as Debian packages,
or if you want to use newer versions, you need to build them from
source which requires the development
r-base-dev that can be installed by
apt-get install r-base-dev
This makes sure that you have the basic requirements for compiling R packages. R packages may then be installed by the local user/admin from the CRAN source packages, typically from inside R using the
function or using
R CMD INSTALL from a shell. If you
have proper write permissions
/usr/local/lib/R/site-library/, and you have not
R_LIBS_USER manually, they will be installed
there. Otherwise, you will be asked if a directory in your home
directory should be created for these packages. A routine update
of such locally compiled packages can be done using
which will update the packages in the first part of your library path. You can have a look at the components of this part by
If you would like to update R packages that have been installed
via the Debian package management system which are installed
/usr/lib/, I would recommend to do
this the Debian way using the source packages from Debian
In order to find packages, R looks at the
R_LIBS_SITE. On Debian and
R_LIBS_USER is set
$platform is something
'x86_64-pc-linux-gnu' and depending on the
version of R installed. You can override this
R_LIBS_SITE is set in
This means that packages installed from within R take precedence over the ones installed via the Debian package management system if you happen to have two versions installed at the same time.
The latest stable versions of R and R packages are readily available in official Debian SID repositories.
The packages recommended by the R core team
r-recommended) are supported on CRAN. Currently,
r-cran-boot r-cran-cluster r-cran-class r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival
Because they rely on the installed version of R, backports of the following packages are also supplied.
littler r-cran-rodbc python-rpy python-rpy2 (jessie only)) rkward r-cran-jags r-cran-coda (needed for r-cran-rjags)
A backport of the current python-rpy2 package to wheezy (oldstable) and squeeze (oldoldstable) would require a backport of python-singledispatch, which appears to be a bit tricky. Some help would be needed to bring this back to wheezy and squeeze..
After a release of Debian "stable", no new packages get added by Debian to keep the release as 'stable' as possible. This implies that the R release contained in the official Debian release will become outdated as time passes. As a courtesy to the R users on the Debian "stable" platforms, the "stable" directory on CRAN contains so-called 'backports' of the current R binaries for the "stable" distribution of Debian.
For a backport of R 3.2.0 to jessie, simply add something like
deb http://<favorite-cran-mirror>/bin/linux/debian jessie-cran3/
to the file /etc/apt/sources.list on your computer. You need to substitute <favorite-cran-mirror> by one of the mirror URLs listed in
The milestone release R 3.0.0 published on April 3, 2013 is not compatible with any R packages built on earlier versions. This means that R packages from the Debian wheezy archive do not work under R 3.x.y (this also applies to squeeze alias oldoldstable). This is the source line needed for R 3.x.y on Debian wheezy
deb http://<favorite-cran-mirror>/bin/linux/debian wheezy-cran3/
Again, you need to substitute <favorite-cran-mirror> by one of the mirror URLs listed in
Of course the R packages
r-cran-* provided here are
compiled using R 3.x.y. Before installing R 3.x.y be sure you do
not rely on loading R packages from Debian wheezy. If unsure,
look at the debs you have installed using
dpkg --get-selections | grep r-cran
and compare with the list of packages supported here (see above, also for a procedure to upgrade packages install locally from source R packages).
This repository also contains backports of tcl8.6, tk8.6 and texinfo for wheezy, as the upstream R 3.2.0 Debian package needs these versions.
Please be aware that the R packages available as binary .deb
packages in wheezy (with names starting with
are not compatible with R 3.x.y. Only a confined number of binary
packages is provided here.
Updating packages installed locally from sources, which you need to do after an upgrade from R 2.x.y to R 3.x.y, is explained below under the section administration and maintenance. What you probably need to do is
> update.packages(.libPaths(), checkBuilt=TRUE)
in order to rebuild packages that are installed in addition to the
r-cran-* packages. For other changes in R
The same notes regarding binary compatibility of R packages with R 3.x.y given for oldstable (wheezy) above also apply to squeeze.
As the first backports for squeeze were still from the R 2.x.y series, the backport of R 3.x.y to Debian squeeze is published in a different location (squeeze-cran3) from what whas used before (squeeze-cran), in order to avoid breaking production systems using the R backports from CRAN plus such Debian stable binary packages
In addition, R 3.2.0 is compiled against tcl/tk 8.5 on squeeze, as version 8.6 is not available and my attempt to backport tcl8.6 failed with an error I did not understand. Please let me know if you encounter problems.
The Debian backports archives on CRAN are signed with the key of "Johannes Ranke (CRAN Debian archive) <email@example.com>" with key ID 381BA480. You can fetch and import this with
apt-key adv --keyserver keys.gnupg.net --recv-key 381BA480
If this doesn't work, it might be due to a firewall blocking port 11371. Alternatively, you can search for 0x381BA480 at http://keyserver.noreply.org/ and copy the key block into a plain text file, named, for instance, jranke_cran.asc wich you add to apt with apt-key add.
There are i386 and amd64 binaries for jessie, wheezy, squeeze. Since R 3.1.0, R is fully functional on arm and armel binaries for jessie and wheezy are provided here as well.
Before R 3.1.0 lazyloading of datasets did not work on arm, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695411. Thanks to Orion Poplawski from the Fedora project, among others, these issues are now fixed, see https://bugs.r-project.org/bugzilla/show_bug.cgi?id=15087.
For other architectures, you can use the source packages from one of the repositories
deb-src http://<favorite-cran-mirror>/bin/linux/debian squeeze-cran3/ deb-src http://<favorite-cran-mirror>/bin/linux/debian wheezy-cran3/ deb-src http://<favorite-cran-mirror>/bin/linux/debian jessie-cran3/
to compile binaries. Note that you need to install current
order to build
r-cran-rjags from the source package
provided in the latter location.
The best place to report problems with these packages or ask R questions specific to Debian is the R-SIG-Debian mailing list. See
for more information.
Anyone interested in building Debian packages (e.g. for an unsupported release, another architecture or an old R version) can have a look at the build scripts used by the current maintainer. These are available anonymously from the Subversion repository
The scripts contain some small changes needed to compile the original Debian packages on the supported release. Note that I did install up to date versions of debhelper and dpkg-dev in the build system for the backports to squeeze.
The Debian R packages are maintained by Dirk Eddelbuettel. The packages present on CRAN for Debian stable, oldstable and oldoldstable are provided by Johannes Ranke. Thanks to Mathieu Basille for restructuring the README in March 2015.