Table of Contents

R

R is a free software environment for statistical computing and graphics.

Information

Usage

See which versions are available:

$ module avail R

Load one version into your environment and run it:

$ module load R/4.3
$ R

Use installed.packages() to check the list of packages installed in the ILRI environment by default. Here is a good resource on installing R packages into user libraries if you need other packages.

Installation

Notes from the sysadmin during installation.

First, compile the main R application:

$ cd /tmp
$ wget https://cran.r-project.org/src/base/R-4/R-4.3.1.tar.gz
$ tar xf R-4.3.1.tar.gz
$ cd R-4.3.1
$ sudo dnf install tcl-devel tk-devel
$ ./configure --enable-R-shlib --prefix=/export/apps/R/4.3
$ chrt -b 0 make -j4
$ sudo mv /export/apps/R/4.3 /export/apps/R/4.3.bak
$ sudo mkdir /export/apps/R/4.3
$ sudo chown aorth:aorth /export/apps/R/4.3
$ make install

Then install some common libraries used by our users because some of them are quite complicated, and installing them globally saves tens of thousands of header files and libraries being installed into user libraries anyways:

$ /export/apps/R/4.3/bin/R
# > Sys.setenv(MAKEFLAGS = "-j2") # didn't try
> options(Ncpus = 4) # This does 4 parallel package installs
> install.packages('sf', repo='https://cloud.r-project.org')
> install.packages("hierfstat", repos="https://cran.r-project.org")
> install.packages("adegenet", repos="https://cran.r-project.org")
> install.packages("BiocManager", repos="https://cran.r-project.org")
> install.packages("poppr", repos="https://cran.r-project.org")
> install.packages("vcfR", repos="https://cran.r-project.org")
> install.packages("devtools", repos="https://cran.r-project.org")
> library(devtools)
> install_github("HenrikBengtsson/TopDom")
> install_github("lucidif/HiCeekR", repos=BiocManager::repositories())
> q()
$ sudo chown -R root:root /export/apps/R/4.3