12.7 Resources

R-Spatial.org

12.7.1 The {sf} package

  • The {sf} package is used for handling spatial data in R
  • It provides functions for reading, writing, and manipulating spatial data
  • It supports various spatial data formats, including shapefiles, GeoJSON, and KML
# sample important {sf} functions
library(sf)

# read shapefile
africa <- st_read("data.shp")
# write shapefile
st_write(africa, "data.shp")

# convert to sf object
africa_sf <- st_as_sf(africa)