Raad2: R

From Research Computing @ TAMUQ
Jump to navigation Jump to search

Getting Started

Available R versions on raad2

cray-R/3.3.3 R/326

Launching R Interactive mode

To load R:

abtakid91@raad2b:~> module load cray-R

Please note that the defult R version (cray-R/3.3.3) will be loaded

You can verify that it is loaded by running:

abtakid91@raad2b:~> module list

To launch R in the interactive mode:

abtakid91@raad2b:~> R

You will see R launching:

R version 3.3.3 (2017-03-06) -- "Another Canoe"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-suse-linux-gnu (64-bit)

Now, you can try some simple R commands. For example, to see the sample iris dataset:

> library(datasets)
> data(iris)
> summary(iris)

Install R packages

To install packages: (e.g. lattice)

> install.packages("lattice")

To load the package:

> library(lattice)

To exit the R interactive mode:

> q()

Running R Scripts

There is a sample R script available here: [DIR] you can run it by issuing this command:

abtakid91@raad2b:~>Rscript sample.R

Submitting R jobs

There is a sample R job file here: [DIR] you can copy it to your home directory and run it:

abtakid91@raad2-gfx:~$ sbatch r.job