Skip to content

Installing Rgdal

What follows are instructions to install rgdal for use within R 3.6.3, and gdal 3.0.4. The following commands will need to be run on one of our login nodes wind or rain.

In order to install rgdal:

    1. Load the R, proj, and gdal modules required for rgdal.

[abc123@wind ~]$ module load R/3.6.3 proj/6.1.0 gdal/3.0.4
2. Export the PKG_CONFIG_PATH environment variable.

[abc123@wind ~]$ export PKG_CONFIG_PATH=/packages/PROJ/6.1.0/lib/pkgconfig
  1. Start R.
[abc123@wind ~]$ R
  1. Install the rgdal package.
> install.packages(c('rgdal'),repos = "http://cran.case.edu", configure.args=c("--with-proj-include=/packages/PROJ/6.1.0/include","--with-proj-lib=/packages/PROJ/6.1.0/lib"))

Troubleshooting

If you receive the proj_create_crs_to_crs_from_pj error, then you will need to force the installer to use an older version. This can be done inside an R shell by executing the following commands:

> packageurl <- "https://cran.r-project.org/src/contrib/Archive/rgdal/rgdal_1.4-8.tar.gz"
> install.packages(packageurl, repos=NULL, type="source")

If you have any questions, please contact us.