Skip to content
NAISS Logo Allocations Support Training Software naiss.se

R

Arrhenius

How to load

module load buildtool-easybuild/5.2.1-hpca3ef7d197 GCC/14.3.0 R/4.5.2

How to use

Command line

Only run very lightweight, short programs on the login node!!!

Start:

$ R

List Packages (inside R):

> installed.packages()

Interactive

To run R as an interactive job, start like this (change if you want more cores and longer time, here 1 hour, and change to your own project ID):

$ module load buildtool-easybuild/5.2.1-hpca3ef7d197  GCC/14.3.0 R/4.5.2
$ interactive -A naissXXXX-XX-XXX-cpu -p cpu -n 1 --time=01:00:00

You will be placed on a compute node where you can run your R scripts directly.

Batch script (CPU, serial)

#!/bin/bash

# Set account 
#SBATCH -A naissXXXX-XX-XXX-cpu 

# Set the time (10 min here - change to what you need)
#SBATCH -t 00:10:00

# ask for 1 core, serial running 
#SBATCH -n 1 # Asking for 1 core

# name output and error file - outcomment if not using. Rename as you want
#SBATCH -o My-R-jobs_%j.out
#SBATCH -e My-R-job_%j.err

# load R 
module load buildtool-easybuild/5.2.1-hpca3ef7d197  GCC/14.3.0 R/4.5.2 

# Run your R script - here it is called hello.R. Change to your own 
R --no-save --quiet < hello.R