The R environment has been integrated into NCI-data-analysis/2021.09 and a batch of R packages belonging to the Conda R-essential bundle are installed under the module NCI-Rlibs/2021.09 from project dk92. Although it contains many popular scientific packages, you may still need to install your own R packages.
You can install an R package to your own working directory. An example of how to install an R package called "caret" is given below
install.packages("caret",lib=USER_WORKING_DIRECTORY,repos="https://cran.csiro.au",dependencies=TRUE)
The "lib" option specifies the target directory for the installation, the "repos" option defines the repository site to fetch the source code from and the "dependencies" option controls whether to build all its dependency libraries (TRUE) or not.
To set the search path to pick up the installed packages in a new session:
.libPaths( c( .libPaths(), USER_WORKDING_DIRECTORY) )
After that, you can check whether the customised R package location has been added
.libPaths()
There are several environmental modules for users to install their own R packages.
Firstly, users can install a package via the "R" module directly. However, there are very limited number of pre-built R packages available from the centralised R module and users may need to build both target R package and its dependencies.
We recommend loading the module NCI-Rlibs/2021.09 when installing a new R package as it provides around 80 popular scientific R packages. Users may find some dependencies of the target R package are already installed. Note the module NCI-Rlibs/2021.09 will load the module R/4.0.0 internally so there is no need to load the R module separately.
The compiler tools may vary on what modules are used and where the R package is built, i.e. Gadi or OOD, as denoted in the table below.
Modules | GADI | OOD (JupyterLab and VDI) | Notes |
R/4.0.0 | --- | OS GCC | Gadi: R/4.0.0 module needs to combine with an Intel compiler to build R packages. OOD: R/4.0.0 module uses the system GCC to build R packages. |
R/4.0.0 intel-compiler/2019.5.281 | Intel compiler | --- | OOD: No intel-compiler available. |
NCI-Rlibs/2021.09 | Intel compiler | OS GCC | Gadi: NCI-Rlibs/2021.09 automatically loads both R and Intel compilers. |
R/4.0.0 NCI-data-analysis/2021.09 | Conda GCC | Conda GCC | NCI-data-analysis/2021.09 module uses its own Conda GCC to build the R packages. |
NCI-data-analysis/2021.09 R/4.0.0 | --- | OS GCC | Loading R/4.0.0 after NCI-data-analysis/2021.09 removes Conda GCC setttings. |
NCI-Rlibs/2021.09 NCI-data-analysis/2021.09 | Conda GCC | Conda GCC | NCI-data-analysis/2021.09 module uses its own Conda GCC to build R packages. |
NCI-data-analysis/2021.09 NCI-Rlibs/2021.09 | Intel compiler | OS GCC | Loading NCI-Rlibs/2021.09 after NCI-data-analysis/2021.09 removes Conda GCC setttings. |