R Installation

<< Click to Display Table of Contents >>

Navigation:  Installation of PAI Infrastructure > Linux Platforms >

R Installation

PAI requires R version 4.0.3 or higher. Please perform the following installation steps (Ubuntu 18.04):

Install R:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/' sudo apt update

sudo apt install r-recommended

Install the required libraries:

sudo apt install libcurl4-openssl-dev

sudo apt install libcairo2-dev

sudo apt install xorg-dev

sudo apt install libssl-dev

sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+

sudo apt-get update

sudo apt-get install r-cran-lme4

sudo apt-get install r-cran-snow

sudo apt-get install r-cran-vgam

Start R at the command line as administrator (“sudo R”) and install the required packages:

install.packages("doBy")

install.packages("psych")

install.packages("e1071")

install.packages("UsingR")

install.packages("lawstat")

install.packages("tseries")

install.packages("np")

install.packages("openair")

install.packages("foreign")

install.packages("Hmisc")

install.packages("car")

install.packages("phia")

install.packages("compare")

install.packages("reshape")

install.packages("sfsmisc")

install.packages("Cairo")

install.packages("pROC")

install.packages("survival")

install.packages("glmnet")

install.packages("mcr")

install.packages("stringr")

install.packages("reticulate")

install.packages("jsonlite")

install.packages("session")

install.packages("keras")

install.packages("Rserve",,"http://rforge.net")

Rserve Configuration

Create the configuration file “/etc/Rserv.conf”.

Create the following content in the configuration file (enables TCP communication with R using port 5999):

remote enable port 5999

fileio disable

encoding utf8

Ensure that the port specified in the configuration file is not used by other applications and is enabled in the firewall. Alternatively a configuration file with user authentication can be used as follows:

remote enable

port 5999

fileio disable

encoding utf8

pwdfile /etc/Rserv.pwd

auth required

plaintext disable

 

The password file Rserv.pwd contains the defined users and passwords. It is a plain text file with tab-separated values:

myUser1 myPassword1

myUser2 myPassword2

 

Load and start Rserve from R:

library("Rserve");

Rserve();

 

Note: depending on how R is being run, it may require additional parameters. In that case the parameter should be passed in the args argument such as:

Rserve(args=’--no-save’);