1. Home
  2. Articles
  3. Courses
    1. Articles
  4. Community
  5. Definitions
  • Login
  • Register
  • Search
R Programming
  • Everywhere
  • R Programming
  • Articles
  • Pages
  • Forum
  • Definitions
  • Course Articles
  • More Options
  1. Scientific Tools
  2. Scientific Tools Articles
  3. R Programming

How to install R in Ubuntu-based distros?

  • SciTools
  • June 10, 2023 at 8:06 PM
  • 491 Views
  • 0 Comments

This is an article on installation instructions of R Programming language in Ubuntu distributions such as Ubuntu, Linux Mint, POP_OS, Mate and ...

Contents [hideshow]
  1. Prerequisites
  2. Installation of R
  3. Get other CRAN packages

Follow the below instructions to install R in your Ubuntu distro:

Prerequisites

First open your Terminal and run the following line:

Assuming that you are not using the "root" user which is the case in many distros. Otherwise, remove the "sudo"

Bash
sudo apt update -qq

Then run the following code to install the helper packages needed for this installation:

Bash
sudo apt install --no-install-recommends software-properties-common dirmngr

Then add the signing key (by Michael Rutter) for these repos.

# To verify key, run the following command:

Bash
gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc

Fingerprint is: E298A3A825C0D65DFD57CBB651716619E084DAB9

Then run the following command:

Bash
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc


Then run the following command to add the R version "4" repo to your package manager:

Bash
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"

Installation of R

Now to install R and its dependencies, run the following command:

Bash
sudo apt install --no-install-recommends r-base

For more details about this version please refer to the official R read me file:

Ubuntu Packages For R - Full Instructions

Get other CRAN packages

Run the following command to add the current R 4.0 or later ‘c2d4u’ repository:

Bash
sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+

You can now do apt install --no-install-recommends r-cran-rstan or apt install --no-install-recommends r-cran-tidyverse to install packages.

Please note that ‘c2d4u’ repository is only available for LTS releases. If you wish to attempt to use the repository with an non-LTS release, you can manually edit the ’c2d4u_team-ubuntu-c2d4u4_0_-*.list’ to use focal instead of the intended release. This usage of the ‘c2d4u’ repository is unsupported. An LTS release is strongly suggested for utilizing the ‘c2d4u’ repository.

_________________

The Debian R packages are maintained by Dirk Eddelbuettel. The Ubuntu packages are compiled for i386 and amd64 by Michael Rutter ([email protected]) using scripts developed by Vincent Goulet.

  • Previous Article How to install R in Linux?
  • Next Article How to install R in Debian

Categories

  1. R Programming 14
  2. Linux 0
  3. Reset Filter
  1. Privacy Policy
  2. Legal Notice
Copyright© ScientificTools.org 2025. All rights reserved.
All the content posted on this website are licenses by MySecure Space GmbH under Creative Commons CC BY-NC-ND 4.0
Creative Commons CC BY-NC-ND 4.0
Developed & Hosted by: MySecure.Space | Powered by: WoltLab Suite™