Getting started
This page provides a quick explanation of using R on the system. For more details, see our R for HPCC workshop materials.
Accessing R and RStudio
R is available on the HPCC by default which means you can run it on the command line by using the command
1 |
|
To avoid any issues resulting from a user-customized .Renviron
or .Rprofile
file, you can also start R by using R --vanilla
.
You can also use R via the RStudio Server interface through OnDemand. See our OnDemand documentation for more details.
Versions and bundles
The HPCC provides many versions of R, but we highly recommend using bundles which include extra R packages. Note that bundles are not loaded by default. There are two bundle flavors that include many common packages from the following sources: CRAN and Bioconductor.
You can see all available bundles with the above two links or by running:
1 |
|
Our current recommendation is to use R-bundle-CRAN/2023.12-foss-2023a
. To access this bundle from the command line, run
1 2 |
|
To access this bundle in RStudio Server, choose the R version "4.3.2 (with additional CRAN packages, RECOMMENDED)".
Module names versus OnDemand versions
The modules on the command line associated with the R versions available through OnDemand are as follows:
OnDemand name | module name |
---|---|
4.3.2 (with additional CRAN packages, RECOMMENDED) | R-bundle-CRAN/2023.12-foss-2023a |
4.4.1 (with additional CRAN packages) | R-bundle-CRAN/2024.06-foss-2023b |
4.3.2 (with additional CRAN packages, RECOMMENDED) | R-bundle-CRAN/2023.12-foss-2023a |
4.4.1 (with additional CRAN packages) | R-bundle-CRAN/2024.06-foss-2023b |
4.4.1 | R/4.4.1-gfbf-2023b |
4.3.3 | R/4.3.3-gfbf-2023b |
4.3.2 (with Bioconductor packages) | R-bundle-Bioconductor/3.18-foss-2023a-R-4.3.2 |
4.3.2 | R/4.3.2-gfbf-2023a |
4.2.2 (with Bioconductor packages) | R-bundle-Bioconductor/3.16-foss-2022b-R-4.2.2 |
4.2.2 (with additional CRAN packages) | R/4.2.2-foss-2022b |
Installing packages
Use the install.packages
command to install packages in R. By default, these packages will be installed into your home directory in ~/R/x86_64-pc-linux-gnu-library/4.X
where X
is the minor version number of the version of R you are using (e.g., 3 for R version 4.3.2
).
If you use a different minor version of R, you will need to reinstall all packages you need into the new location.
Managing different node types (how to fix "Illegal instruction error")
The HPCC has many different types of nodes you can run your code on. See a listing here.
When R installs a package, it customizes it to the type of node you installed it on. It is not guaranteed that you can then run this package on other node types.
Therefore, when using R, we recommend always choosing the same node type (whether you are using a development node, a SLURM job, or OnDemand). To select a node type use the following steps:
Method | Instructions |
---|---|
On a development node | Choose the development node with the same name as the nodetype (e.g., dev-intel16 corresponds to intel16 nodes) |
In a SLURM job | Add a constraint like #SBATCH --constraint=intel16 |
In OnDemand | Choose the Node type in the Advanced Options menu |
If you aren't sure which node type to use, choose intel16. There are the largest number of nodes, and it is the oldest which lowers the chance of compatibility issues.
For more on this topic, see our page on Architecture Specific Compilation.