R

R is a language and environment for statistical computing and graphics. R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, …) and graphical techniques, and is highly extensible.

The S language is often the vehicle of choice for research in statistical methodology, and R provides an Open Source route to participation in that activity.

One of R’s strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control.

R is available as Free Software under the terms of the Free Software Foundation‘s GNU General Public License in source code form.

The webpage of R is at http://www.r-project.org/.

R is compiled and installed on HPC clusters. The command to start R is “R”.

# R

To run R in batch mode to execute your computational intensive analysis, you can submit the job to PBS batch queue “serial” or large memory queues such as “parallel”, “large” and “short”. Assume your R program is named “prog.R”, the sample script for job submission is as below:

Batch job submission to serial if the program takes less than 4GB memory:

#PBS -q short
#PBS -j oe
#PBS -N rserial
#PBS -l select=1:ncpus=1:mem=4GB
cd $PBS_O_WORKDIR
source /etc/profile.d/modules.sh
module load R-3.2.5
Rscript prog.R

Batch job submission to a large memory queues if the program takes more than 4GB memory:

#PBS -q openmp
#PBS -j oe
#PBS -N rserial
#PBS -l select=1:ncpus=1:mem=30GB
cd $PBS_O_WORKDIR
source /etc/profile.d/modules.sh
module load R-3.2.5
Rscript prog.R

When your R program generates temporary data files, you need to add the following lines into the file  “.bash_profile” under your home directory.

export TMPDIR=/home/svu/username/TMP
export TMP=/home/svu/username/TMP
export R_TEMPDIR=/home/svu/username/TMP

Replace the “username” with your NUS account name, and remember to create the directory “TMP” at your home directory by:

 # cd
 # mkdir  TMP

For more details about batch job submission, monitor and termination, please check at How to Run Batch Jobs.