7

I am trying out the examples mentioned in this link . I have successfully installed all the packages mentioned as the basic packages here. When I try to use command gmap (given in the example as mymap <- gmap("France") i get the following problem:

> gmap("France")
Loading required namespace: rgdal
Failed with error:  ‘there is no package called ‘rgdal’’
Error in gmap("France") : rgdal not available

Also I am aware that gmap command belongs to the package dismo. And I have successfully installed this package.

Shreta Ghimire
  • 1,019
  • 2
  • 13
  • 27
  • 1
    Did you try to install `rgdal`? (`install.packages("rgdal")`) Can you provide your `sessionInfo()`? – MrFlick Aug 21 '15 at 04:50

3 Answers3

1

to install rgdal upgrade your R version to at least 3.5.0

https://cran.r-project.org/package=rgdal

0

I had the same trouble and was getting an error 'rgdal' was built under R version 3.1.3. when I was trying install.packages("rgdal"), and installation of package had non-zero exit status when trying install.packages('rgdal', type = "source")

But it worked just now, try again.

Liza
  • 1,066
  • 2
  • 16
  • 26
  • 4
    how did it worked? I still receive the same error message of the OP: `install.packages("rgdal")` : `package ‘rgdal’ is not available (for R version 3.2.3)` (same with `type="source"`) – Antonello May 19 '17 at 11:29
  • try updating your R – Liza Aug 16 '17 at 17:11
  • I can confirm that updating R! allows to install `rgdal` package. For installation of the latest R! I followed this link: https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-16-04-2 – matandked Oct 11 '17 at 13:02
0

One of the reasons for this error is an outdated version of the core R package. On Ubuntu, for instance, this happens if the r-base package is installed from the universe repository.

The fix is to add the CRAN repository and install R from there:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
sudo apt-get update
sudo apt-get install r-base
Luís de Sousa
  • 5,765
  • 11
  • 49
  • 86
  • I tried this and I get "The following packages have unmet dependencies: r-base-core : Depends: libcurl3 (>= 7.28.0) but it is not going to be installed Depends: libpng12-0 (>= 1.2.13-4) but it is not installable Depends: libreadline6 (>= 6.0) but it is not installable Recommends: r-recommended but it is not going to be installed E: Unable to correct problems, you have held broken packages. – Anna Naden Sep 07 '20 at 02:26
  • @AnnaNaden As the message says you have broken packages in you system. [Check this thread](https://askubuntu.com/questions/223237/unable-to-correct-problems-you-have-held-broken-packages) for ways to deal with that particular issue. – Luís de Sousa Sep 07 '20 at 13:18