2.2 Installing R with CRAN on Ubuntu

20241007

Quick Start

sudo apt install r-recommended
wget https://raw.githubusercontent.com/eddelbuettel/r2u/refs/heads/master/inst/scripts/add_cranapt_noble.sh
sudo bash add_cranapt_noble.sh

Details

The comprehensive R archive network (CRAN) hosts over 5,000 R packages available for any installation of R. For MacOS and Windows the packages are available for direct installation. On GNU/Linux the packages generally need to be built before they are installed. Either way we use R’s install.packages() command to install any one of these 5,000 packages.

We can utilise the advantages of a direct installation (no source download and build) with Debian packages that are already compiled and ready to run. Only a small subset of the CRAN packages are pre-compiled in this way in the default distributions of Linux.

Dirk Eddelbuettel has built a full archive of CRAN packages ready to install on Ubuntu. All R packages can be installed as Debian packages on Ubuntu with names like r-cran-janitor, etc. The github repository for r2u provides the details.

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