How to run R

From CCM
Jump to: navigation, search

Disclaimer: This is a work in progress started by a novice user of the cluster. Before using any information presented here, refer to the rest of this wiki for information on best practices. Edits are welcome on this page and questions can be directed to Kathleen Gatliffe, who doesn't remember her office number.


Running R Interactively

R code should first be run interactively on a limited data set until it is proven to be stable. R can be accessed and run directly from the terminal by typing R. Commands can be typed or cut and pasted from files. To exit an R session in the terminal type,


Loading Packages

The server is preloaded with many R packages. If you need any that are not loaded, you can attempt to install them from R. The first time you do this, the system will deny your request and offer to create a library folder in your home directory. Once this folder is created, any other packages you install will be installed in this folder. Once a package is installed in your library it can be called and used as normal.

Installing package into ‘/usr/local/lib/R/site-library’ 
(as ‘lib’ is unspecified)
Warning in install.packages("name of package") :
  'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead?  (y/n) y
Would you like to create a personal library
to install packages into?  (y/n) y

In order to install packages from Github, you need first to install the devtools package in R. Once installed, you can use it to install your Github package with the command devtools::install_github(""). For example, in order to install Professor French's spatial tools package, you would type,


You may be prompted to update existing packages. Choosing to do so will install the updates in your ‘/usr/local/lib/R/site-library’ folder, it will not update the packages on the server.

Submitting Jobs

In order for the server to compile your code, you must identify it as an R script within a shell file. The shell file can be created through a text editor but must have .sh as the suffix. To run your R code you must identify it as an Rscript with the shell file.

Rscript  RCode.R

It is good practice to include lines to create log and error files within the shell script as well.

Queuing a Job

Killing Jobs


Univa Grid Engine User Guide

A quick but thorough overview from the Bioinfomatics group at the Berlin Institute of Medical System Biology.

Personal tools