Install the sf package on Ubuntu 20.04

[This article was first published on Pachá, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I was unable to install the sf package on a clean Ubuntu 20.04 setup, and the problem is attributed to incompatible software versions. My workaround, instead of installing the package from source, was to install a precompiled binary package, but that depends on configuring a PPA for GDAL.

To add the PPA I run this command from bash

sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt update && sudo apt upgrade

The last command updated some packages that sf sources required, which I installed with

sudo apt-get install libgdal-dev gdal-bin libproj15 libproj19 libproj-dev

Then I added a PPA maintained by CRAN, which contains binary R packages

sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+
sudo apt update && sudo apt install r-cran-sf

And that’s it!

To leave a comment for the author, please follow the link and comment on their blog: Pachá.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)