Installing R Packages
On RCAC clusters, you can load any R modules (r-bioconductor, r-rnaseq, etc.) and install packages using BiocManager or install.packages. However, since you don't have write access to the system library, you will need to install the packages in your custom location. Here is how you can do it:
-
Create the required directory in your desired location. For home directory.
This is just an example, but you can use a project specific package directory if you prefer.
Warning
Create separate packages directory for major versions of R. For example,
local/r_packages/4.4.1forR 4.4.1. -
Install the packages in your custom library:
You can also run this within an R session, if you prefer:
-
Modify library path to ensure R knows about your custom library (modify
~/.Renvironfile): -
Test the installation:
and in R session:
This should load your libraries and should show the path to your custom library.
Using RStudio¶
Alternatively, if using RStudio, you can also set the environment variable in the RStudio configuration file. Add the following line to your ~/.Renviron file:
When the file opens, add the following line:
save and restart RStudio. You can test .libPaths() in RStudio to see if the path is set correctly.