I'm trying to install package "raster" in R for spatial analysis and some of the packages, those are not seem bo be installed with "raster - terra, raster, vis, rgdal.
I've tried so far:
install.packages("pbkrtes"),
install.packages("terra", dependencies = TRUE), etc
But it does not go... Here is the pic of the last attempt. I have ubuntu 22.04 and R 4.3.2
Would anybody hint me for the solution?
I tried previously what I could find in Stack... didn't help
Those packages depend on GDAL, GEOS, and PROJ. In the old days, one needed to install these using system commands. (Since you don't lay out what has been tried previously, we cannot know if you did any of that spadework.) But my understanding is that the sf
-package dependencies which is the core of spatial packages, will now orchestrate the installation of those system packages, so you should first try:
install.packages("rgdal")
install.packages("rgeos"
install.packages("sf")
If that fails (and I'm unable to test whether it will succeed since I have a complete version on my Ubuntu 18.04 system), then search SO on the topic of errors in installation of sf
and rgdal
.
This website: https://r-spatial.github.io/sf/ recommends this script for system-mediated installation of those dependencies (obviously from a Terminal session):
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev libsqlite0-dev