2.2 Installing R with CRAN on Ubuntu

20241007

The comprehensive R archive network (CRAN) hosts over 5,000 R packages.

On Linux we use R’s install.pacakges() command to install any one of these 5,000 packages. This will install the package from source which will often involve compilation.

The Debian packages, on the other hand, are already compiled and ready to run. Unfortunately only a small subset of the CRAN packages are pre-compiled in the default distributions of Linux.

Luckily though the full archive is available pre-compiled for Ubuntu through the incredible work of Dirk Eddelbuettel and others. All R packages can be installed as Debian packages on Ubuntu with names like r-cran-janitor, etc. Dirk’s github repository for [r2u]{https://github.com/eddelbuettel/r2u} provides the details.

In particular, shell scripts are provided to setup your system to use R2U. For example add_cranapt_noble.sh can be run as the admin user (root) on your Debian or Ubuntu computer to set up the R2U repository. This command works out of the box for a Ubuntu 24.04 LTS (named as noble). Support for other versions of Ubuntu is available.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0