R
This guide will help you familiarise yourself with R on HPC.
For more advanced information, please consult the official documentation of the application:
Run code autonomous
The easiest way to run your R code on HPC is to save your code in a file and run it with the Rscript utility.
Here a very simple example R script file, it's named myRCode.R:
Now if you want to execute this within your Slurm job submission, just use one of our templates here and edit it as described below. The example submission script is named mySlurmJob.sh.
In our submission script, we will now run the code autonomously via Rscript by supplying it as a simple parameter:
Now we can just submit our submission script with the Slurm sbatch utility:
You will find the generated console output in the file you specified in the --output parameter within your Slurm submission.
Install packages in custom space
Per default, your downloaded R packages are saved within your $HOME directory in .R/<version>. If you are running out of space, you can move the installation path into a different directory.
Info
The paths and names used here are examples. Please adjust them to what fits for the environment you are working with.
Create a software directory:
Install packages into the new directory within R:
Add the new directory to $R_LIBS_USER variable. With this set, R will expand its software search to the directory specified:
$R_LIBS_USER has to be set like this whenever you want to use the software in your custom directory. You can either do this at the beginning of your job, in your submission script or add it to your ~/.bashrc profile script, to make it available at every login.