What is R?
R is a programming language that is utilized to analyze, report and make graphical representations. It was developed in New Zealand By Ross Ihaka and Robert Gentlemen, and that’s what refers to the ‘R’ in the R language. The R’s center is an interpreted computer language that permits looping, branching, and modular programming languages by using different functions. It is highly efficient as it allows the integration with C, C++, FORTRAN, .Net, AND Python. Different operating systems utilize its pre-compiled binary versions such as Mac, Windows, and Linux.
Features of R:
Some of the useful features of the R language are given below:
- It is efficient at handling data and storage.
- It supports integrated and large collections of tools for analyzing the data.
- R is a simple, fully-featured, and well-developed programming language that can be used for embedding input and output facilities, loops, conditions, or multiple functions in your code.
- It also provides a graphical analysis of the data.
In short, R is the world’s most broadly used programming language. Data scientists and the contributor community always look forward to the R language due to its diversity.
So, that was a brief but comprehensive introduction to the R language. Now let’s move toward its Installation on Ubuntu 20.04.
Note: To follow the installation, make sure that you are a ‘superuser’ or ‘root’ as the superuser provides unrestricted access to all the commands, files, resources, and directories.
Install R on Ubuntu 20.04
Step 1: First of all, Open up the terminal by searching it manually in activities, or you can also press ‘CTRL+ALT+T’ to view the terminal window.
Step 2: Now update the package lists.
$ sudo apt-get update
Enter your password to allow the process for packages updates.
Step 3: Before adding a new repository, we are going to add essential dependencies first. To take this action type the command given below.
$ sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common
Enter ‘y’ to permit the process.
Step 4: Now we are going to add the CRN repository on our Ubuntu 20.04.
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
$ sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
Now update packages.
$ sudo apt update
Step 5: Type the following command for the Installation of R on Ubuntu 20.04.
$ sudo apt install r-base
Enter ‘y’ to continue.
Wait for some time, as all of the packages are going to be extracted from the repository.
Step 6: Now check the version of R by executing the following command.
$ sudo -i R
Step 7: Install the ‘txtplot’ package by writing out this command on your terminal.
Now it’s time to test the working state of R on the system. By executing these commands which will show you a plot with axis labels based on the given data.
> txtplot(cars[,1], cars[,2], xlab = 'speed', ylab = 'distance')
It all started with a comprehensive introduction of the R language. We shared some of the R language features that will make you think about its diversity in the range of programming languages. After that, we have shown you a complete procedure of R installation on Ubuntu 20.04.