Running R on the HPC

The R Project for Statistical Computing

To run the R program, you have to source the following file:

if your shell is csh/tcsh
source /usr/local/profile.d/R.csh
if your shell is bash
source /usr/local/profile.d/R.sh

You should not run long analyzes on the login nodes. Please use the moab job scheduler for these kind of jobs. An example job submission script could look like,

#!/bin/sh

#MOAB -l nodes=1
#MOAB -N RJOB
#MOAB -l walltime=1:00:00
#MOAB -j oe

source /usr/local/profile.d/R.sh

R --vanilla < yourRscript

Since you are running in a non-interactive mode, you have to cat your script since R doesn't load files from the command line and you are required to supply at least one of these options --save, --no-save or --vanilla. In the example above, we cat the file yourRscript by using redirection (<). See man R about the meaning of the save options.

For more information about R, see the R-project website.