provided by Frank de Vos This is a very short manual on how to use R on the cluster. Using R from the grid You can start R by typing /usr/bin/R/ in your terminal screen, or by simply typing R. This is what you will get to see: frank@corleone01:~ R R version 2.15.0 (2012-03-30) Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-redhat-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. > You will be able to use R and for example install libraries. Installing a library in R can be done using the install.packages() function. For example: > install.packages("arf3DS4", repos= c("http://R-Forge.R-project.org", getOption("repos"))) (note: the ">" symbol is only used as a notation convention, omit it when trying the function) This will install the arf3DS4 package for analyzing fMRI data. You will be asked for permission to create a personal R folder where this library will be stored. You will also be asked to select a cran mirror, you can for example select "Amsterdam". You can quit R by typing: > q() Submitting R jobs Probably, you will be mainly using the cluster to submit jobs. You will first have to create an R script that contains the to be executed tasks. For example: x=rnorm(10,0,1) write.table(x,file="/home/frank/test.txt") This script will write a file called test.txt to my home directory. This script have to be saved somewhere on the cluster. You can submit this job using the following command: /usr/bin/R --vanilla --slave < /home/frank/test_script.R This will execute the script test_script.R from the head node. Normally, you should not use the head node to submit jobs. You should submit your job to a queue. You can submit a job to a queue using the qsub command: echo '/usr/bin/R --vanilla --slave < /home/frank/test_script.R' | qsub -S /bin/bash \ -q veryshort.q@corleone05.fsw.leidenuniv.nl This will submit the job test_script.R to the veryshort queue on corleone05. For the very short queue job time is limited to 30 minutes. For longer scripts you can use the short, long and very long queues. Details about these queues can be found on blackboard in the file "ClusterConfig.xls". When your job is submitted you will get the following message: Your job 22168 ("STDIN") has been submitted