Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install R on CentOS 8 - DesignLinux

May 29 2020
designlinux 0 Comments
How to Install R on CentOS 8

R is an open-source programming language. It’s specially used for statistical computing and data mining for developing statistical software and performing data analysis. This tutorial covers how to install R on CentOS 8 system.

Prerequisites#

Before you start installation on CentOS, ensure that:

  • You are logged in with non-root user account with administrator privileges.
  • Your system has at least 1GB of RAM.

Installing R on CentOS#

By default R packages are not available in CentOS repositories. We will install it from the EPEL repositories.

sudo yum install epel-release

If EPEL repository not installed on your machine you then add it using below command:

It will prompt to accept the repository GPG key, type y and hit Enter.

Once the repository added issue below command to install R:

sudo yum install R

You can verify the installation by running the following command which will print the R version:

R --version
R version 3.6.2 (2019-12-12) -- "Dark and Stormy Night"
Copyright (C) 2019 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/.

Install the required libraries used by R packages:

sudo yum install make gcc gcc-c++ libcurl-devel libxml2-devel openssl-devel texlive-*

R is installed successfully on your CentOS system, and you can start using it.

Install R Packages from CRAN#

R is popular because of wide availability of packages through the Comprehensive R Archive Network (CRAN).

We are going to install a stringr package for an example, which provides fast, correct implementations of common string manipulations.

Start by opening the R console as root:

sudo -i R

It will show as below:

R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
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 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.

> 

To install stringr package just type:

install.packages("stringr")

It will show output as below:

Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Secure CRAN mirrors

Select the mirror that is closest to your location.

Installation will take some time and after completion load library using:

library(stringr)

Let’s create a simple vector named demo:

demo <- c("How", "to", "Install", "R", "on", "CentOS", "8")

Now run the below command to print the length of a string:

str_length(demo)
[1] 3 2 7 1 2 6 1

If you want to install more packages you can find it at CRAN Packages.

Conclusion#

You have successfully learned how to install R on CentOS 8 system.

If you have any problem or suggestion please leave a comment below.

Related

Tags: centos

How to Check Kernel Version in Linux System

Prev Post

How to Install and Use PHP Composer on Ubuntu 20.04

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 1,069
  • 610,428

DesignLinux.com © All rights reserved

Go to mobile version