DEBIAN PACKAGES OF R SOFTWARE

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.

DEBIAN STABLE

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 the latest R release to lenny, simply add something like

   deb http://<favorite-cran-mirror>/bin/linux/debian lenny-cran/

to the file /etc/apt/sources.list on your computer and install as usual. There are binaries for the i386 and amd64 architectures. You can use the source packages from

   deb-src http://<favorite-cran-mirror>/bin/linux/debian lenny-cran/

to compile binaries for other platforms.

The newest R release can then be installed using a command sequence like

   apt-get update
   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). 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.

If you have been apt-pinning R from unstable as described here before, it is now advised to use the backported packages and to remove or comment out the entries for unstable (sid) in /etc/apt/preferences and /etc/apt/sources.list.

DEBIAN OLDSTABLE

For a backport of R 2.10.0 to etch, 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. There are binaries 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.

SUPPORTED PACKAGES

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 set are kept up-to-date on CRAN. Currently, these are:

   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, I also provide versions of the following packages as up-to-date as the Debian release allows:

   littler
   r-cran-rodbc

SECURE APT

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

ADMINISTRATION AND MAINTENANCE OF R PACKAGES

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.

REPORTING PROBLEMS

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.

BACKPORTING FOR DEBIAN

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.

ACKNOWLEDGEMENT

The Debian R packages are maintained by Dirk Eddelbuettel. The packages present on CRAN for stable and oldstable (etch) are provided by Johannes Ranke.