## Using R

R is a free software environment for statistical computing and graphics. The main website for R is located at the R Project. R is a free implementation of the S language.

### Running R

#### Loading R

Checking for available R installations can be done with VALET as such:

$ vpkg_versions r Available versions in package (* = default version): [/opt/shared/valet/2.0/etc/r.vpkg_json] r The R Project for Statistical Computing * 3.1.1 Version 3.1.1 3 alias to r/3.1 3.1 alias to r/3.1.1 $ vpkg_require r/3

#### Interactive R

For interactive R sessions, make sure you use `workgroup`

and the appropriate job scheduler command such as `qlogin`

for GridEngine or `salloc`

for Slurm to connect to a compute node, then select the version of R you want to use

$ vpkg_require r Adding package `r/3.1.1` to your environment

and then you can execute

$ R

Additionally, if you would like to make R quiet about starting and exiting, try

$ R -q --no-save

#### Scheduling R

See the cluster details for R script in batch and R script array job in batch examples for more information on running R in batch.

Most simply from a compute node, you can execute

$ Rscript /path/to/script.r

## Details by clusters

## Additional Resources

- Quick-R on-line tutorial
- UCLA idre on-line tutorial
- SWIRL interactive tutorial (may not be available by default)
- R in action book
- O'Reilly Learning R Book
- Stack Overflow Questions and Answers
- R for SAS and SPSS users PDF An excellent guide for converting SAS® and SPSS® to R.