24.3 C
Senior Writer and partner

How to install R programming on Ubuntu 20.04 /18.04?

Programming is an elementary part of computer science. It creates applications that solve some daily problems. You can make applications of all kinds and some oriented to statistics. So, this article will help you install R programming in Ubuntu 20.04 / 18.04.

R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS.In addition, it is also a very well documented language and has its own LaTeX-like documentation format.


Among the advantages of R, is its great syntactic similarity with S-Plus, which has facilitated the migration of many users. Equally important is the fact that it is a language with a very active development cycle.

One of R’s strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed.

- Advertisement -

Another great advantage is that R is multiplatform, that is to say, it can be installed both in Windows and in any Linux distribution.

Let’s not talk anymore and we are going to install R programming on Ubuntu 18.04.

0. What you need

In the first place, it is necessary that you have installed Ubuntu 20.04 / 18.04 which is the recommended platform for development with this language.

It is also necessary that you have a user who can execute commands in the terminal as root.

So, let’s start.

1. Upgrade the system

In order to have the latest security patches and thus ensure the proper functioning of the system, it is necessary to make a general update to all packages.

:~$ sudo apt update && sudo apt upgrade

Now, you can continue with the installation.

2. Add GPG keys for the R repository

A simple way to install R is through APT. To do this we must add the R repository, however, first you have to add the GPG key.

:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

Then, add the repository.

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

Now, you can install R programming.

3. Install R programming

Now just run the command to install R programming.

:~$ sudo apt update
:~$ sudo apt install r-base

4.- Install R programming
1.- Install R programming

Now, you can start to use R.

4. Verify the installation and using R

Now, it is necessary to verify the installation that we have made. To do this, type on the terminal.

:~$ sudo -i R

And you’ll see R’s console.

5.- R console on Ubuntu 18.04
5.- R console on Ubuntu 20.04 / 18.04

Now let’s make the typical “Hello World” using R.

6.- Hello World
6.- Hello World

5. Conclusion

R is not a programming language for all people or for all circumstances. On the other hand, it is a language rather oriented to manipulation of data for statistical purposes and that makes it a quite reliable alternative for your subject.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article