rgdal not available for R version 3.2.2 - r

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.

to install rgdal upgrade your R version to at least 3.5.0
https://cran.r-project.org/package=rgdal

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.

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

Related

R ERROR: dependencies ‘xml2’, ‘httr’ are not available for package (Linux Mint 20.1)

I did not quite know where this belongs exactly, so I decided to post this here on stack overflow.
I recently had package issues with R and R-Studio on Linux Mint 20.1, where I always recieved dependency errors when installing packages like plotly and tidyverse. Therefore, in order to test if my system was responsible I live booted a fresh Linux Mint USB and installed R and R-Studio the following way:
sudo apt update
sudo apt dist-upgrade
sudo apt install r-base
Then download R-Studio from here and installed it like:
sudo apt-get install gdebi-core
# Install R-Studio with gdebi
sudo gdebi rstudio-1.2.5042-amd64.deb
Then, I opened RStudio by typing rstudio in the terminal. Inside RStudio I tried to install the package tidyverse by install.packages("tidyverse") which resulted in some dependency errors like:
ERROR: dependencies ‘xml2’, ‘httr’ are not available for package ‘rvest’
* removing ‘/home/mint/R/x86_64-pc-linux-gnu-library/3.6/rvest’
* installing *source* package ‘tibble’ ...
The solution was to use the command, suggested in the r-lib issue by #fredaas:
sudo apt install build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev
By using this command I was able to resolve the issue and install every package I required flawlessly.
I am sorry if this does not belong here but I hope I can help someone saving hours of troubleshooting. This issues is maybe caused by Linux Mint or the most recent R Version 4.0.3 so I was not sure where to share my results.

Having difficulty with re-installing R in Ubuntu 18.04

Very recently I shifted to Ubuntu from Windows and downloaded R-base (3.4.4) and R studio. However, some packages (car, ROCR etc) were not available and hence I tried to update R. Because of error messages, I finally tried to uninstall and remove R and then install it again.
I tried
sudo apt-get upgrade
sudo apt install r-base
However, it is showing me error message like,
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
r-base : Depends: r-recommended (= 3.6.2.20200221-1~ubuntu18.04.1~ppa1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
So basically right now, I have no R-base installed.
I tried to remove R-base.
sudo apt-get remove r-base
And all I am getting is-
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'r-base' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I am a beginner in both R and Linux. I need your valuable suggestions.
Thanks in advance.
If you are using Ubuntu 18.04, please follow these steps if you are using your local machine of your own. (If your are working in any office environment please setup proxy and follow these steps)
1) Let’s first add the relevant GPG key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
2) Add the R Repository
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
3) Update Package Lists
sudo apt update
4) Install R
sudo apt install r-base
5) Test Install
sudo -i R
6) Installing R Packages from CRAN
install.packages('dplyr')

how can i install the packages in r properly and correctly using Rstudio app?

I tried to install "xlsx" package using Rstudio, and i couldn't install it.
I am trying to install my packages using install.packages("xlsxjars"). I already tried doing that from Tools window in Rstudio app, and I tried using the console.
I am using Linux (Gnome 17.04). I get this error:
input
install.packages("xlsxjars")
output
Installing package into ‘/home/aim/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/xlsxjars_0.6.1.tar.gz'
Error in install.packages : error reading from connection
if you get some Errors while installing r packages kind of somthing.so is miising or some packages are missing depending on the version of R, you should try this commands because, i had this kind of errors with R 3.0.x in Ubuntu 14.04
so i upgrade my R version to fix it with the following commands :
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" »
gpg —keyserver keyserver.ubuntu.com —recv-key E084DAB9
gpg -a —export E084DAB9 | sudo apt-key add -
sudo apt-get —purge remove r-base-core
sudo apt-get update
sudo apt-get -y install r-base
sudo apt-get update
now i can install all packages without errors
I totally agree with the answer of #kissi salim yahia
Just want to add . When you tape in R
install.packages("your_package")
you got some dependencies below.
these one may have troubles sometimes. So just need to install them manually from the SHELL like:
sudo apt-get install r-cran-your_dependencie
I spent a while struggling with that too. Eventually I just gave up as the java in that package was out of date and I would have needed to load older Java up to get it to run. I would suggest readxl instead.
A simple intro to the package can be found here: https://www.datacamp.com/community/tutorials/r-tutorial-read-excel-into-r#readxl

RCurl Installation in R 3.1.1: package 'RCurl' is not available (for R version 3.1.1)?

It says in Cran that RCurl should be for R >3.0.0 but R 3.1.1 in Debian Jessie fires the error:
package 'RCurl' is not available (for R version 3)
the same problem with rjson. The dependencies are libcurl and make that are installed. What is the problem with R 3.1.1 in installing the libcurl packages such as RCurl? How to overcome this the most convenient way?
P.s. I know this thread but any method did not solve this issue.
Apt-get install the 3.1.1 R version by default, for example in Debian Jessie. We can either install the newest version of R with the newest RCurl or install the archived version of RCurl working in R 3.1.1.
Solution A
You can install the newest version, source, such that
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/debian jessie-cran3/" >> /etc/apt/sources.list'
sudo apt-key adv --keyserver subkeys.pgp.net --recv-key 381BA480
sudo apt-get update
sudo apt-get install r-base r-base-dev
and now you can install RCurl in R, working in R 3.3.2.
Solution B
Install the Curl from the CRAN Archieves matching the 3.1.1 R, apparently this here as suggested by Imo in the comment.

Installing rgl and rgdal packages in R 3.3.2 on Ubuntu 16.10

I'm using R 3.3.2 and Ubuntu 16.10. I'm unable to install rgl and rgdal packages.
When I use
install.packages("rgl")
gives the following error message:
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ‘rgl’
When I use
install.packages("rgdal")
gives the following error message:
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
Edited
When I use
sudo apt-get install r-cran-rgl
in Ubuntu Terminal, it says
r-cran-rgl is already the newest version (0.95.1441-2)
However, the latest version of rgl is 0.96.0.
When I use
sudo apt-get install libgdal-dev libgeos++-dev
it throws the following error:
The following packages have unmet dependencies:
libgdal-dev : Depends: libopenjp2-7-dev but it is not going to be installed
I found a solution that was useful for me here: http://robinlovelace.net/r/2013/11/26/installing-rgdal-on-ubuntu.html.
In short, the solution would be this tree command lines:
sudo apt-get install aptitude # install aptitude as an alternative to apt-get
sudo aptitude install libgdal-dev # install the package (you may have to respond to queries here)
sudo aptitude install libproj-dev # install the proj.4 projection library
For rgl, just do sudo apt-get install r-cran-rgl.
For rgdal, follow the recommendation of the spatial folks eg here for sf and do this
add ubuntugis-unstable to the package repositories (e.g. with sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable and then sudo apt-get install libgdal-dev libgeos++-dev)
For general 'R on Ubuntu or Debian' questions, go to the r-sig-debian list.
Edit: Note that you don't need need ubuntugis-unstable repo if the current/older libgdal, libproj4 versions are good enough for you. Those are in the Ubuntu distro so just do sudo apt-get install ....
These installations worked for me provided that, in addition, I installed libxerces-c28. The need for the related shared object was indicated in the error log the first time I tried, after doing the installations indicated (libgdal, libgdal-dev, etc)

Resources