In this short article we will learn how to install R language on CentOS 8 operating system and try a simple code to run.
Introduction
R is a powerful and open-source programming language and environment designed for statistical computing and data analysis. Developed by statisticians and data scientists, R has gained immense popularity in both academia and the business world due to its extensive libraries, data visualization capabilities, and a vibrant community of users and contributors. In this article, we’ll explore the key features, benefits, and applications of the R language.
Key Features of R
- Statistical Analysis: R excels in statistical analysis and data manipulation. It provides a wide range of statistical techniques, including linear and nonlinear modeling, time-series analysis, hypothesis testing, and more.
- Open Source: R is open-source software, which means it is freely available to anyone, and its source code can be modified and redistributed under the terms of the GNU General Public License (GPL).
- Vast Library Ecosystem: R boasts a vast collection of user-contributed packages and libraries, which extend its functionality for various data analysis tasks. These packages cover topics such as machine learning, data visualization, and Bayesian statistics.
- Data Visualization: R offers exceptional data visualization capabilities, with packages like ggplot2 that allow users to create complex and aesthetically pleasing plots and charts. Visualization is crucial for data exploration and presentation.
- Data Manipulation: R provides powerful tools for data cleaning, transformation, and reshaping. The dplyr and tidyr packages are widely used for data manipulation tasks.
- Integration: R can easily integrate with other programming languages like C, C++, and Python. This is particularly useful for incorporating specialized libraries or optimizing performance-critical code.
- Reproducibility: R scripts and projects are highly reproducible, making it an excellent choice for research and data analysis where transparency and reproducibility are essential.
- Community and Support: R has a large and active community of users and developers who contribute packages, documentation, and provide support through forums, mailing lists, and social media.
Benefits of Using R
- Data Analysis: R is tailor-made for data analysis tasks, making it the go-to choice for statisticians and data scientists.
- Free and Open Source: R’s open-source nature eliminates licensing costs, making it an accessible tool for individuals, educational institutions, and businesses.
- Data Visualization: R’s data visualization capabilities enable users to create publication-quality graphics for data exploration and presentation.
- Machine Learning: R provides a growing ecosystem of machine learning packages, allowing users to build predictive models and perform data-driven decision-making.
- Data Mining: R can be used for data mining tasks, including clustering, association rule mining, and text mining, through various packages.
- Statistical Reporting: R facilitates the creation of statistical reports and documents using tools like R Markdown, allowing users to blend code, results, and narrative in a single document.
Applications of R
- Academia and Research: R is extensively used in academic research across various disciplines, including economics, biology, and social sciences.
- Data Science: R plays a pivotal role in data science projects, from data exploration and modeling to data visualization and reporting.
- Finance: R is used for risk modeling, portfolio optimization, and financial analysis in the finance industry.
- Healthcare: R is applied in medical research, epidemiology, and clinical trials analysis.
- Business Intelligence: R helps businesses gain insights from data, make data-driven decisions, and improve operational efficiency.
- Marketing and Advertising: R is employed for customer segmentation, campaign analysis, and market research.
How To Install R Language on CentOS 8 Operating System
In this sub chapter, we will learn how to install R language on CentOS 8 operating system. We hope this article will be helpful for anyone who seeks for R installation procedure. Here we go.
1. Enable the EPEL Repository
2. Update System Repository
3. Install R Language
4. Trying R Language
Before we are starting the installation process, there are some prerequisites which are to be met, as follow :
- A running CentOS 8 system
- A non-root sudo user with sudo privilege
- Sufficient disk space
1. Enable the EPEL Repository
To enable the EPEL repository, open a terminal and run the following command:
$ sudo dnf install epel-release $ sudo dnf config-manager --set-enabled PowerTools
2. Update System Repository
The next step is to update our system repository, by submitting command line:
$ sudo dnf update
3. Install R Language on CentOS
To install R language, we will submit the following command line :
$ sudo dnf install R
Output :
[ramans@bckinfo ~]$ sudo dnf install R Last metadata expiration check: 0:02:20 ago on Thu 07 Sep 2023 08:32:14 AM PDT. Dependencies resolved. =========================================================================================================================== Package Architecture Version Repository Size =========================================================================================================================== Installing: R x86_64 4.3.1-1.el8 epel 41 k Upgrading: cpp x86_64 8.5.0-4.el8_5 AppStream 10 M expat x86_64 2.2.5-4.el8 BaseOS 111 k fontconfig x86_64 2.13.1-4.el8 BaseOS 274 k freetype x86_64 2.9.1-4.el8_3.1 BaseOS 394 k gcc x86_64 8.5.0-4.el8_5 AppStream 23 M
. . .
Installed: . . . tcl-devel-1:8.6.8-2.el8.x86_64 tidy-5.6.0-5.el8.x86_64 tk-1:8.6.8-1.el8.x86_64 tk-devel-1:8.6.8-1.el8.x86_64 tre-0.8.0-27.20140228gitc2f5d13.el8.x86_64 tre-common-0.8.0-27.20140228gitc2f5d13.el8.noarch tre-devel-0.8.0-27.20140228gitc2f5d13.el8.x86_64 xorg-x11-proto-devel-2020.1-3.el8.noarch xz-devel-5.2.4-3.el8.x86_64 zlib-devel-1.2.11-17.el8.x86_64
Complete!
After the installation is completed successfully, then we will verify it by querying its version.
$ R --version
Output :
[ramans@bckinfo ~]$ R --version R version 4.3.1 (2023-06-16) -- "Beagle Scouts" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-redhat-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/.
4. Trying R Language
In this sub chapter, we will try to try R language demo with simple script. The first step is to switch our OS account to R, then download R package from CRAN official website.
$ sudo -i R
Output :
[ramans@bckinfo ~]$ sudo -i R [sudo] password for ramans: R version 4.3.1 (2023-06-16) -- "Beagle Scouts" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-redhat-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.
> # create two strings > string1 = "bckinfo" > string2 = "R Language" > > # concatenate two strings using separator > result = paste(string1, string2, sep = "-") > > print(result) [1] "bckinfo-R Language"
So far, we have successfully installed R language on CentOS 8 operating system and take an demo with simple script.
Conclusion
R is a versatile and robust programming language and environment for statistical computing and data analysis. Its rich ecosystem of packages, data visualization capabilities, and active community make it an invaluable tool for statisticians, data scientists, researchers, and businesses seeking to derive insights and make data-driven decisions. Whether you’re a beginner or an experienced data professional, R offers the tools and resources to explore, analyze, and visualize data effectively.