R packages for the base system have been part of the Debian distribution since 1997. 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.
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. Simply add something like
deb http://<favorite-cran-mirror>/bin/linux/debian etch-cran/
to the file /etc/apt/sources.list on your computer and install as usual. We currently provide inaries for the i386 and amd64 architectures. You can use the source packages from
deb-src http://<favorite-cran-mirror>/bin/linux/debian etch-cran/
to compile binaries for other platforms.
At the time of this update (2008-10-26), the testing distribution with codename lenny is frozen. If you run testing, and still want to use up to date R packages from unstable, you can use pinning by creating a file /etc/apt/preferences, e.g. containing
Package: * Pin: release a=testing Pin-Priority: 650 Package: * Pin: release a=sid Pin-Priority: 600
and install R 2.8.0 from unstable using a command like
apt-get -t unstable install r-base r-base-dev
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).
A number of R packages are available from the Debian repositories with names starting with r-cran-. Note, however, that only the packages part of the r-recommended bundle are kept up-to-date on CRAN. Currently, these are:
r-cran-boot r-cran-cluster r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mgcv r-cran-nlme r-cran-rpart r-cran-survival r-cran-vr
Because they rely on the installed version of R, we also provide versions of the following packages as up-to-date as the Debian release allows:
littler rkward r-cran-rodbc python-rpy python-rpy-doc
Please notice that the backporters are not necessarily users of these packages themselves, so positive or negative feedback through the usual channels (see below) would be appreciated.
The Debian backports archives on CRAN are signed with the key of "Johannes Ranke (CRAN Debian archive) <jranke@uni-bremen.de>" with key ID 381BA480. You can fetch this with
gpg --keyserver subkeys.pgp.net --recv-key 381BA480
If this doesn't work, it might be due to a firewall blocking port 11371. If you cannot or don't want to change that, you can search for the key at http://keyserver.noreply.org/ and copy it into a plain text file, named, for instance, jranke_cran.asc.
If receiving the key with gpg did work, you can also export it to a text file
gpg -a --export 381BA480 > jranke_cran.asc
and then, as root, make it known to apt-key by
apt-key add jranke_cran.asc
The recommended policy for installing and maintaining R on Debian Linux is as follows:
A standard R installation is provided by Debian's r-base package. Hence,
apt-get install r-base
installs the complete set of packages derived from the principal R sources provided by the R Core team.
Users can opt to select only a subset of these packages by installing them individually (e.g. by omitting some of the extra documentation packages, or only parts of the r-recommended bundle).
All packages (in the R sense) derived from the main R sources install into the directory /usr/lib/R/library and can be updated using apt-get (as root, or via sudo).
Other Debian packages (e.g., r-cran-*) can be installed and updated using apt-get (as root); Debian's R package will install them to /usr/lib/R/site-library.
The command
apt-cache rdepends r-base-core
shows all packages that depend on r-base-core; this comprises a large number of contributed packages from CRAN and other repositories.
If you want to install R packages not provided as Debian packages, or if you want to use newer versions, you need to get the development package
apt-get install r-base-dev
first, which makes sure that you have the basic requirements for compiling R packages. R packages may be installed by the local user/admin from the CRAN source packages, typically from inside R using the
> install.packages()
function, into /usr/local/lib/R/site-library/. This depends on local policy and setting of proper write permissions on /usr/local/lib/R/site-library/ to permit users to install and update R packages. A routine update can then be undertaken from R using
> update.packages(lib.loc="/usr/local/lib/R/site-library")
Individual users can always install R packages into their home directory. The simplest procedure is to create a file ~/.Renviron containing, e.g.,
R_LIBS_USER="~/lib/R/library/%v"
The install.packages() and update.packages() will then work in a version-specific subdirectory of ~/lib/R/library which will be interactively created on demand. If you don't want to reinstall all libraries after installing a new major version, because in most cases it is not necessary, you can leave out the "/%v" of the path given above.
In addition we currently provide R 2.4.1 packages for the "oldstable" distribution of Debian (sarge) in the oldstable directory. The sources line for this looks like
deb http://<favorite-cran-mirror>/bin/linux/debian sarge/
A backport of R 2.4.0 to the even older distribution before oldstable (woody) is available via the repository of Christian Steigies
deb http://people.debian.org/~cts/R/debian woody/
The best place to report problems with these packages or ask R questions specific to Debian is the R-SIG-Debian mailing list. See
https://stat.ethz.ch/mailman/listinfo/r-sig-debian
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
http://kriemhild.uft.uni-bremen.de/viewvc/r-backports
The scripts contain many small changes needed to compile the original Debian packages on the supported release.
The Debian R packages are maintained by Dirk Eddelbuettel and Doug Bates. The backports for Debian stable are provided by Johannes Ranke.