does anyone have any tips on how to install rgdal in Ubuntu 22.04? i tried install.packages() and i tried with sudo apt, but no luck.
I am new to Linux/Ubuntu and absolutely at my wits' end (and regretting moving to Ubuntu!)
#r #rstudo #rgdal #dataviz #datavis #ubuntu

@stingh

I would suggest using @eddelbuettel r2u project to keep all your R packages fresh in Ubuntu, including {rgdal}. I am using it on the laptop I use for teaching/presentations and works great.

Details at: https://eddelbuettel.github.io/r2u/

After you've set up your system, it is just a quick:

$ sudo apt install r-cran-rgdal

CRAN as Ubuntu Binaries - r2u

Easy, fast, reliable -- pick all three!

@jmcastagnetto @stingh

Thanks for the endorsement!

And thanks to the 'magic' of `bspm` you can do the same from #Rstats which may be an easier transition for those new to `apt`:

Rscript -e 'install.packages("rgdal")'

will also take care of `rgdal`, all its R dependencies *and* all their system dependencies. All as binaries. Automagically.

#r2u: Fast. Easy. Reliable. Pick all three.

@eddelbuettel @jmcastagnetto
hey, thanks for the suggestion, i will check that out!

@eddelbuettel @jmcastagnetto @stingh

Always meant to ask: does this require admin/sudo rights at any point in time?

@henrikbengtsson @jmcastagnetto @stingh

Of course it does. `r2u` is *primarily* an `apt` repo, and you cannot use `apt` without appropriate permissions.

The beauty of `bspm` is that it offers all that power via a redirection (also requiring those rights) to 'do the Right Thing (TM)' from the `install.packages()` interface familiar to #rstats users.

And that works on laptops, desktop, containers, cloud instances, CI runs, ... and note I never mentioned HPC clusters.

@henrikbengtsson @jmcastagnetto @stingh

That said you can likely take advantage of the 22k CRAN binaries and 400 BioC binaries to create a container for your talk which, once made, may well be deployed via singularity on an hpc platform. Probably worth a test. Ping me if you want to pursue that venue.

@eddelbuettel @jmcastagnetto @stingh Automagically *if* you run that as sudo, yes? And if you run install.packages(...) as a normal user what happens? The normal failings?

@geospacedman @jmcastagnetto @stingh

Just try it and see:

docker run --rm -ti rocker/r2u Rscript -e 'install.packages("tidyverse")'

@eddelbuettel @jmcastagnetto @stingh that runs as a privileged user though, I was wondering about the utility of it in a multi-user system, or the possibility of a user breaking their R libraries or an install failing by doing install.packages as an unpriv user.

@geospacedman @jmcastagnetto @stingh It is a good and somewhat open question (maybe make it an issue?). I am using it on a server for students but I think _there_ I will hide the bspm and r2u aspect (for use by the admins incl me) so that the students will _first_ install into their local ~/R/ directory.

In short I still think we can mix and match. r2u will cover the basic few hundred packages and make updates easy.

@stingh {rgdal} hast been retired. The general recommendation is to use {sf} instead. Also have a look at {vapour}.
@tim_salabim
thanks for the suggestion, i just tried sf, but that wasn't working on Ubuntu either (error with some dependencies which i could not install independently either), installed fine on my work laptop though, which uses windows!
@stingh have you read the instructions on the sf github readme?
https://github.com/r-spatial/sf#ubuntu
I reccomend the ubuntugis-unstable route.
GitHub - r-spatial/sf: Simple Features for R

Simple Features for R. Contribute to r-spatial/sf development by creating an account on GitHub.

GitHub
@tim_salabim @stingh I think ubuntugis-unstable PPA cannot be mixed with r2u, as you may get a version clash of upstream libraries.
@edzer @stingh may well be. I don't use r2u...
@tim_salabim @edzer @stingh In my experience combining the ubuntugis-unstable PPA and r2u poses no problem as long as you manually build and install {sf} in a user library with higher precedence for R than the library used by r2u. This way, you can still profit from r2u for most CRAN packages. Currently I do this for sf, lwgeom, terra, ragg and svglite (latter two also need conflicting sysdeps).
@florisvdh @tim_salabim @stingh yes, of course, but I consider that "not using r2u" for the spatial packages involved.