R

R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS.

Usage

Example script : testR.sh

#!/bin/bash

#SBATCH -e R_test%j.err
#SBATCH -o R_test%j.msg
#SBATCH -p thin
#SBATCH -N 4
#SBATCH --ntasks-per-node=24

module load R/4.2.1

R --help
R --version

Submit with :

sbatch --account=your_project_ID testR.sh

How to install R packages

The user can install the needed R packages in a custom folder into /fs/agustina/USER, for instance, we can install the R-package glmnet in a custom folder called R_libs with these commands:

mkdir -p /fs/agustina/$(whoami)/R_libs
module load R/4.2.1
R
install.packages("glmnet", repos="http://cran.r-project.org", lib="/fs/agustina/USERNAME/R_libs/")
.libPaths(c("/fs/agustina/USERNAME/R_libs/", .libPaths()))
library(glmnet)

More info :