Working with Spatial Data in R
A comprehensive guide to handling, analyzing, and visualizing spatial data in R using sf, terra, and related packages.
RSpatial DataGISVisualization
Introduction
Modern spatial data analysis in R has become more accessible with packages like sf and terra. This guide covers essential techniques for working with spatial data.
Vector Operations with sf
R
library(sf)
library(ggplot2)
# Read and process spatial data
nc <- st_read(system.file("shape/nc.shp", package = "sf"))
# Create a spatial visualization
ggplot(nc) +
geom_sf(aes(fill = AREA)) +
scale_fill_viridis_c() +
theme_minimal()
Raster Operations
Discover techniques for working with raster data using the terra package.