sf_load_save

How to load and save spatial vector data in R?

In this tutorial you will learn how to load and save spatial vector data in R using the sf package, including the most popular formats: shapefile (.shp), GeoPackage (.gpkg) and GeoJSON (.geojson). In addition, you will find here more advanced examples of using GDAL Virtual File Systems to facilitate data loading, and spatial and non-spatial data preselection using SQL queries.

The source data comes from Natural Earth.