R language installation

How To Install R Language On Ubuntu 20.04 LTS

R is programming language for statistical computing and graphics. R is open-source and supported by the R Foundation . The R language is the most used by among statisticians and data miners for developing statistical software and data analysis. The official R software environment is written primarily in C, Fortran, and R itself and is freely available under the GNU General Public License. Pre-compiled executables are provided for various operating systems.

On this article, we will discuss how to install R language on Ubuntu 20.04 LTS. The R installation will be divided into several step as described below.

  • Prerequisites
  • Installing R on Ubuntu
  • Using R Languange
  • Conclusion

Prerequisites

For R installation, there will be several prerequisite to be fullfiled, such as:

  • sufficient space for R binary files
  • at least 1GB of RAM
  • a non-root user with sudo privileges

Installing R on Ubuntu 20.04 LTS

We will use R language respository from the external repository maintained by CRAN (Comprehensive R Archive Network). CRAN maintains the repositories within their network, but not all external repositories are reliable. Be sure to install only from trusted sources. While this articel is writing, the last R language version is version 4.0.1.

  • Update the system
ramans@otodiginet:/$ sudo apt update
[sudo] password for ramans:
Hit:1 http://us.archive.ubuntu.com/ubuntu focal InRelease
  • Enable the CRAN repository and add the CRAN GPG key to our system
ramans@otodiginet:/$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
Executing: /tmp/apt-key-gpghome.Qf1do6p8aa/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg: key 51716619E084DAB9: public key "Michael Rutter marutter@gmail.com" imported
gpg: Total number processed: 1
gpg: imported: 1
Enable CRAN repository
ramans@otodiginet:/$ sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
Adding R-project to the repostory
  • Install R languange by submitting command line below.
ramans@otodiginet:/$ sudo apt install r-base
sudo apt install r-base
R language installation
  • Verify R installation

After the installation was completed, we have to verify if the installation process was successful. To check it, we will run the command line which will print the R version.

ramans@otodiginet:/$ 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)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.
How to know the R languageversion
R version

So far, the R language installation was completed done, It can be verified by querying the R version as described above. The next step is to install the R package installation from CRAN.

Using R on Ubuntu

R package requires the compiler to be compiled, for this purpose had installed the build-essenstial on Ubuntu Linux 20.04. The build-essentials was already discussed ontthe earlier article, just chekt it out here (How To Install GCC On Ubuntu 20.04 LTS).

R interactive console

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *