R

What is R

R is a language designed for statistical computing and graphics. The home page for R is at https://www.r-project.org.
For an introduction see What is R? at the R project site.

Currently the cluster has two versions of R installed; the latest 3.5 and an earlier 3.4.4. If you just type “R” you will get the default version as that is in the path /usr/bin/R.

$ R --version
R version 4.0.2 (2020-06-22) -- "Taking Off Again"

Quick Help

R 
> help(Startup)

When R starts (with default options), it loads the .Rprofile and .Renviron files in the working directory or user’s home directory.

Installing R Packages

It is best to install the R packages that you require into your own local R library.

By default R will install local R packages under the directory specified by the “R_LIBS_USER” environment variable. You can check what this is within an R session with > Sys.getenv("R_LIBS_USER"). The default setting for this is ~/R/x86_64-redhat-linux-gnu-library/. Under there you will find a directory for each version of R.

Some users prefer to set their own directory for R packages. A .Renviron file will override any defaults. Note that R is usually forwards-compatible with libraries installed from previous versions of R but not always.

$ mkdir ~/R/library 
$ echo 'R_LIBS_USER="~/R/library"' > $HOME/.Renviron

You can also install to a specific location using the “lib” option to the install.packages function.

$ R 
> install.packages("name-of-your-package", lib="~/R/library")

Useful References

This site https://www.statmethods.net/interface/help.html has some quick help on basic R topics. It’s a useful starting place.

Fun with .Rprofile and customizing R startup

Efficient R programming – This is the online version of the O’Reilly book “Efficient R Programming”.

R Installation and Administration

If you wish to find out if the not yet released versions have changed documentation then read http://stat.ethz.ch/R-manual/ and from there you can follow the “R-devel” link to find the docs for the next version of R. You can also go directly to Packages in the standard library and Documentation for package ‘base’ version.

Finally if you really do like R you should read the The R Inferno (PDF) by Patrick Burns. This is written in a satirical style after Dante’s Inferno.

This is custom footer