Using R in the institute
R is a programming language with easily installable extensions (a.k.a. "libraries" a.k.a. "packages"). This page contains information about how to use it in the MPI/CBS.
Permanent Link:
Multiple releases
Permanent Link:

Several R releases are provided in parallel - you
have to select one beforehand. Up to including Linux platform generation 6, R was installed directly on workstations and computer servers while more recent releases could be selected explicitly. Since this caused confusion, R is no longer installed on workstations but has to always be selected explicitly.
- To simply run the the latest R release available:
user@host > R+
- This is not advised if you need stable results for your computations.
- The latest R release will change from time to time.
- To identify the latest R release once and use it explicitly for whenever you run R:
-
user@host> R+ --versions
- The latest available release is marked "default". Remember it (e.g.
4.2.0 ).
- Run the respective release explicitly:
user@host> R+ --version 4.2.0
- Upon failure of running a specified R release,
R+ won't continue but will fail hard to ensure you'll only do computations with your intended release version.
A Graphical environment
Permanent Link:

RStudio is available on all institute computers. It works like this:
- To do CPU intensive computations, select a compute server first:
user@host > getserver -sL
- Select an R release. Example:
user@host > R+ --version 4.2.0
- Run RStudio via the
rstudio command.
- This can be combined. Example:
user@host > R+ --version 4.2.0 rstudio
Package compartmentalization
Permanent Link:

R+ will make sure to put Packages in the right place and protect you from surprises when changing the platform or when using a different R release. R+ will open a context depending on R-minor release (e.g. "4.4") and your current platform generation (e.g. G8). It will prevent mixing up libraries when switching between incompatible platform generations or R releases. Some examples about compatiblity:
- Packages on G8 for R 4.4.1 and 4.4.3 are always identical (minor release is 4.4 in both cases)
- Packages on G8 for R 4.0 and R 4.4 are not (different minor releases)
- Packages for R 4.4 on G8 and G9 are not identical.
Example process where this is relevant:
- You start
user@host > R+ --version 4.0.0 rstudio
- You install libraries there, do computations and the project becomes dormant.
- A month later - a new R release is available - you start working on a new project
user@host > R+ --version 4.5.0 rstudio
- You'll notice that no libraries are installed, yet - although you'd installed some while working with R 4.0.0 .
- Now you you need to resume your first project:
user@host > R+ --version 4.0.0 rstudio
- You'll notice that the state of libraries is exactly the same as you left it a month ago - even though you installed libraries for your new project.
This compartmentalization covers all platform-generation/R-minor-release combinations. In these examples, rstudio was used with the R+ wrapper. However, this also work for R scripts and even shell scripts containing calls to R scripts.
Legacy package management
Some years ago R+ used to just trust R to download, compile and install packages into the correct location. However, R doesn't know about multiple software platform generations being used with the same user account (e.g. G6 and G7). The R+ wrapper now has two modes:
- Original R behavior of selecting package locations. This behavior has a serious downside: When moving to a new software platform, your libraries might stop working since system libraries changed. Also: You might end um breaking your working package collection when using multiple platform generations alternating.
- The recommended one: #packages
R+ tries to enable the platform aware behavior. These conditions have to be satisfied:
- You have a personal software folder. If you don't, create one here.
- There are NO packages currently installed in the respective original location.
If you're willing to re-install the packages, you're currently using, the easiest way to achieve that is to remove the R folder in your home directory. If you're unsure, rename it. If you removed it and regret it later, write a ticket and ask IT to restore if from backup.
R+ will test all conditions on startup and switch to software platform aware behavior, if possible. It will fallback to original behavior, if not all the conditions are satisfied.
Non-interactive R computations (e.g. via Slurm)
You might be interested in running R without GUI - usually to put it into higher-level scripts or to use a
batch compute cluster. Here's an example for the steps to take
- Start RStudio:
user@host > R+ --version 4.5.0 rstudio
- To avoid surprises, always select the R release explicitely. If the version is not available, R+ will fail to start to avoid running computations using the wrong R release.
- Develop your script, install libraries, etc. . The script is assumed to be saved as
/data/pt_12345/myscript.R
- To run your script on a command line, combine it with the R wrapper:
user@host > R+ --version 4.5.0 Rscript /data/pt_12345/myscript.R
- To run the R-script in Slurm, just use the full commandline when defining the Cluster-Job.