R is the name of both a programming language and a tool for statistics and stochastic simulations.
On the cluster, R version 3.6.3 is installed.
An introduction to R can be found here.
On this page you can find instruction on calling R, running scripts on the cluster and installing packages.
For calling the interactive R environment, the corresponding module needs to be loaded:
module load R
Afterwards, it suffices to enter
Note that it is a capital
R. Here are some short example commands in the R environment:
# This is a comment. > > 2 # Output an integer  2 > 2+3 # Simple addition  5 > log(2) # natural logarithm  0.6931472 > > x <- "Hello World!" # Saves a string in a variable > x  "Hello World!"
Individual commands or scripts (see below) can be run with the command
$ Rscript -e "log(2)"
The commands need to be enclosed in either single or double quotes.
As usual, R calls can also be put into a shell script instead of entering the manually in the console:
#!/bin/bash Rscript -e "'Hello World!'" Rscript -e "'1+1='" Rscript -e 1+1
This will produce the following output:
 "Hello World!"  "1+1="  2
With the scheduler SLURM, such a script can also be run on multiple nodes:
$ sbatch -N 2 my_Rscript.sh  "Hello World!"  "Hello World!"  "1+1="  "1+1="  2  2
In this example, two nodes are used. You can learn more about jobs here
R has a system for installing packages. The available packages are listed on the CRAN homepage.
You can install R packages on the OMNI cluster yourself. By default, the packages are installed into your home directory (in a subdirectory also named
R). They are then available to you. If a large number of users needs the same packages (e.g. an entire chair), we can also install packages in a central location for you. In this case please contact firstname.lastname@example.org.
In order to install a package:
Open the R console on the cluster with
In the R console, enter:
The package name needs to be in quotes.
Select an installation mirror. This choice does not matter much, except that closer mirrors might be faster than ones that are further away (e.g. outside Europe). If you are connected via an SSH connection with X window support, R might open a window here.
Note the output. It may happen that R needs to compile external code (e.g. C code), in that case errors may occur. If a package installation fails, contact the HPC support or join us in our consultation hour.