This article will give you a complete description of the R programming language installation on the Debian 10 system.
Prerequisites
You should have the following prerequisites for R language installation:
- Your system should have at least 1G or less than 1GB of RAM. If you don’t have installed the required RAM, then use a swap file option.
- Ensure that you must log in as a root user or should have ‘sudo’ privileges.
Open the terminal command line window. To do this, click the top section ‘Activities’ and type the ‘Terminal’ keyword in the search bar. Click on the ‘Terminal’ icon as follows:
R installation on Debian 10
The installation of R is completed into the following different steps, which we are mentioned below in detail:
The R package, which installation from the Debian repository, is usually outdated. Therefore, we will install the latest stable version of R from another repository maintained by CRAN.
Step 1: Install the required packages for adding a repository
Use the following command to install all necessary packages which are required to add a new CRAN repository:
Step 2: Enable repository for installation
Execute the below-mentioned command to enable the CRAN repository and import the following CRAN GPG key to your system:
Step 3: Update system packages
Update the packages by running the below-mentioned command:
Step 4: R installation
Use the below command on the terminal to install R on your system as follows:
Now, check the R language installation on your Debian 10 system by using the below-given command:
You will notice that the latest stable version of R is printed on the terminal:
Install required R packages from CRAN
You can find a wide range of R packages through the CRAN, which stands for Comprehensive R Archive Network that is the main reason R language is becoming popular day by day.
Install the following package that contains the required tools for compiling or building R packages:
To install any R package, first, you need to open the R console environment on the terminal by typing the following command with sudo or root privileges:
Now, you can install R packages on your system. Let’s take an example. You want to install the R package ‘Stringr’ for string manipulation. For that purpose, enter the following command in the R console as follows:
Installation of the ‘Stringr’ package will complete in a few seconds. After that, you will load the relevant library by using the following command:
Print first Program in R Console
In this program, we will create a character vector with name tutorial as follows:
Now, use the following command to print this on the terminal:
To find the length of the string, type the command as follows:
The following vector length will display on the screen:
You can also install more R packages from CRAN by using the following command:
Conclusion
You have learned how to install R and run R programs on the Debian 10 environment. We have provided in this article how to install R packages by using a simple command from CRAN. You can easily Install any R packages and load its associative library on your system. Now, you can easily install and use R on your Debian system.
from Linux Hint https://ift.tt/3sIpip0
0 Comments