For generalized information and instructions on installing R packages on Monsoon, please see: What is the preferred way to install R packages/libraries on Monsoon? – https://ask.cyberinfrastructure.org/t/1694
Prerequisites
Understanding external dependencies
Note that rgdal’s entry on CRAN states in its description that the GDAL and PROJ libraries are external to the package. They must first be correctly installed or otherwise made available to a user’s environment through means such as the module
system, which is more often the case in HPC environments.
The OnDemand web-gateway and R/RStudio
Rather than perform R-package installations within the RStudio “app” on Monsoon’s OnDemand web-gateway, please use an interactive linux shell (as shown below) via a login-node to do the initial ‘rgdal’ installation. (For technical reasons, the compute-nodes don’t carry the same complement of development-supporting software packages that the login nodes do – and the RStudio app runs on the compute nodes.)
As long as you perform the installation within the same version of R version you choose when launching OnDemand’s RStudio “app”, the libraries should then be available for immediate use.
Installation instructions
- Load R and gdal:
$ module load R/4.0.2 gdal/3.1.4
- Open an interactive R shell:
$ R
- Execute the required (CRAN) installation:
> install.packages('rgdal')
- When prompted, type the number for any US-based mirror listed
- Be aware that an individual ‘rgdal’ installation is specific to the version of R you are using, as indicated by the placement of the installations in your
~/R/<version>/
directory.
The gdal/3.1.4
module will side-load a few other modules that are also required.
Usage instructions
Since ‘rgdal’ requires external dependencies you’ll need to remember to make that software available to your environment before using it, or you will encounter errors.
When using an interactive shell or Slurm job script, just remember to first module load gdal/3.1.4
, for example.
When using the RStudio “app” from our OnDemand gateway, you can use the same command through R’s system()
command.