[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedSeptember 8, 2023

How to Install R on CentOS 7

How To Install R On CentOS 7

This tutorial will teach you how to install R on CentOS 7 and how to install R packages from the official Comprehensive R Archive Network (CRAN) .

 

Installing R on Centos

At the time of writing the latest stable version of R is version 3.5.

To install R on CentOS 7, follow these steps:

  1. R packages are available in the EPEL repositories. If you don’t have EPEL repository installed on your machine you can do it by typing:

    sudo yum install epel-release

    You will be prompted to accept the repository GPG key, type y and hit Enter.

  2. Once the repository is added, install R by typing:

    sudo yum install R

    R is a meta package that contains all the necessary R components.

  3. Verify the installation by typing the following command which will print the R version:

    R --version
    R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
    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/.

 

Installing R Packages from CRAN

One of the main reasons why R is so popular is the wide array of packages available through the Comprehensive R Archive Network (CRAN).

For demonstration purposes, we’ll install a package named stringr , which provides fast and correct implementations of common string manipulations.

When started as root the packages will be installed globally and available for all system users. If you start R without sudo, a personal library will be set up for your user.

Start by opening the R console as a root:

sudo -i R
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
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 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.

>

Install the stringr package by running the following command:

install.packages("stringr")

You will be asked to select a CRAN mirror:

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.

The installation will take some time and once completed, load the library by typing:

library(stringr)

Next, create a simple character vector named tutorial:

tutorial <- c("How", "to", "Install", "R", "on", "CentOS", "7")

Run the following function which will print the length of each string:

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

 

Conclusion

You have successfully installed R your CentOS machine and learned how to install R packages.

Keep reading
How to use the MTR command on Linux
February 21, 2023

How to use the MTR command on Linux

How to use the MTR command on Linux MTR (Matt’s traceroute) is a program with a command-line interface that serves for network diagnostic and troubleshooting. The advantage of this software is that it combines the functionality of the Ping command and the Traceroute. Just like a typical traceroute…

Read article
How to Install a Let’s Encrypt Certificate on your Ubuntu 18.04 Dedicated Server or VPS
February 21, 2023

How to Install a Let’s Encrypt Certificate on your Ubuntu 18.04 Dedicated Server or VPS

How to Install a Let’s Encrypt Certificate on your Ubuntu 18.04 Dedicated Server or VPS Installing a Let’s Encrypt TLS/SSL (Transport Layer Security or Secure Sockets Layer) certificate is one of the most important steps in securing your Ubuntu 18.04 server. This is a plus to your website if you…

Read article
How To Use Journalctl to View and Manipulate Systemd Logs
February 21, 2023

How To Use Journalctl to View and Manipulate Systemd Logs

How To Use Journalctl to View and Manipulate Systemd Logs Some of the most compelling advantages of systemd are those involved with process and system logging. When using other tools, logs are usually dispersed throughout the system, handled by different daemons and processes, and can be fairly…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00