YouTube Icon

Code Playground.

How to Install R on Ubuntu 20.04


How to Install R on Ubuntu 20.04

R is an open-source programming language and free climate that has practical experience in factual figuring and graphical portrayal. It is principally utilized by analysts and information excavators for creating factual programming and performing information examination. 

This article covers the means needed to introduce R on Ubuntu 20.04. 


Guarantee that you have met the accompanying requirements before proceeding with this instructional exercise: 

  • Your framework has at any rate 1G of RAM. Something else, make a trade document . 
  • You are signed in as a client with sudo benefits . 

Introducing R on Ubuntu 

The R bundles remembered for the default Ubuntu vaults are frequently obsolete. We'll introduce R from the CRAN storehouse. 

To introduce R on Ubuntu 20.04, follow these means: 

Introduce the conditions important to include another vault over HTTPS: 

sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common

Add the CRAN vault to your framework sources' rundown: 

sudo apt-key adv --keyserver --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb focal-cran40/'

Introduce R by composing: 

sudo apt install r-base

The establishment may take a couple of moments to finish. When finished, confirm it by printing the R form: 

R --version
R version 4.0.1 (2020-06-06) -- "See Things Now"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

That is it, R has been introduced on your Ubuntu machine, and you can begin utilizing it. 

Compiling R Packages

One of the fundamental reasons why R is so famous is the huge swath of bundles accessible through the Comprehensive R Archive Network (CRAN). 

To have the option to assemble R bundles, you have to introduce the manufacture fundamental bundle: 

sudo apt install build-essential

For showing purposes, we'll introduce a bundle named stringr , which gives quick, right usage of basic string controls. 

When begun as root the bundles will be introduced worldwide and accessible for all framework clients. On the off chance that you start R without sudo , an individual library will be set up for your client. 

Open the R reassure: 


Introduce the stringr bundle by composing: 


The establishment will take some time and once complete, load the library with: 


Make a basic character vector named instructional exercise: 

tutorial <- c("How", "to", "Install", "R", "on", "Ubuntu", "20.04")

Run the accompanying capacity which prints the length of a string: 

[1] 3 2 7 1 2 6 5

You can discover more R bundles at Available CRAN Packages By Name and introduce them with install.packages(). 

Rather than arranging the R bundles, you can introduce them as Debian bundles from the cran2deb4ubuntu archive. 


We've told you the best way to introduce R on Ubuntu 20.04 and incorporate R bundles. 

In the event that you hit an issue or have input, leave a remark underneath.