Error in library(rgdal) : there is no package called ‘rgdal

So this is the rather cryptic line that tells you that package installation has failed (exit status = 0 means success). Looking up a few lines, the reason seems to be that there's a problem with the PROJ installation:

I haven't had to fix this before, myself, so I don't know if (re)installation of the library is necessary, or if it's just a matter of making sure there are pointers to it in the standard places R is looking. I hope somebody else with experience with this particular system requirement will chime in!

I'm not entirely sure what you mean, but it sounds like you will probably have to ask whoever administers the server to fix this for you. Most R packages do not have complex non-R system requirements, but for the ones that do (like rgdal), you usually need to look at the package's CRAN page under "System requirements" to see what the package requires, and then figure out how to install those non-R tools on your system. Sometimes this is as easy as using the Linux system's built-in package manager (e.g., apt or yum), but not always. Sometimes the R package maintainer will have a website with more detailed installation instructions (if so, it will also be linked from the CRAN page).

Briefly looking at the 3 packages you were having trouble with, here's what I see:

  • rgdal: we already established that it's not installing because of a problem with the PROJ installation on the server
  • plotKML: depends on rgdal (rgdal is in the "Imports" list), so it won't install until you've got rgdal installed successfully. It doesn't have any other external requirements, so if you can get rgdal installed, this one should install easily.
  • RSAGA: depends on rgdal, so it won't install until you've got rgdal installed successfully. Also has the system requirement of needing SAGA GIS (since it's just an R interface to the SAGA command line software). The Github page has a link for the SAGA GIS download.

Dealing with these sorts of external dependencies is definitely not much fun! If this is a popular combination of base system and spatial packages, it's possible that somebody else has made a script that will get everything set up at once — you could try web searching to see. Otherwise you (or whoever administers your server) probably needs to do it step by step.

P.S. It doesn't sound like this problem is actually specific to the RStudio IDE, so I changed the category to cut down on noise in the RStudio IDE channel (you can also do this yourself!).

1 Like