Installing Packages

RCDS installs several packages along with R, but if there is a package that you want to use that isn’t installed, it is straightforward to install it into your home directory and use it from there.

ibestadm@slartibartfast ~ $ mkdir Rpackages
ibestadm@slartibartfast ~ $ module load R
ibestadm@slartibartfast ~ $ R

R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("gridExtra",lib="/mnt/lfs2/ibestadm/Rpackages/",dependencies=T)



 #SBATCH -p short

 . /usr/modules/init/bash  
 module load R

 Rscript my_r_commands.R

To submit the script, use the following command:

 # sbatch R.slurm

Temporary files

By default R creates its temporary files in the /tmp directory - which is typically not large on our servers (this helps prevent users from inadvertently crashing the server). If you have some R code that creates large temporary files (more than a GB or two), you’ll want to tell R to put those temp files in our Lustre system. This temp file issue can cause R commands to error out for mysterious reasons.

First create a tmp directory

mkdir ~/tmp

then create (or add to) an ~/.Renviron file

echo "TMP = /mnt/lfs2/your_user_name/tmp" >> ~/.Renviron
echo "TMPDIR = /mnt/lfs2/your_user_name/tmp" >> ~/.Renviron

Now, when you start R, it will put temporary files in Lustre where there is typically plenty of room.


Many of the standalone servers run RStudio Server, which you can log into (only from UI campus or VPN) using a web browser, eg: https://ford.ibest.uidaho.edu