Introduction to the sf Package

The sf package is a common R package for working with vector data. This lesson will help you get it installed and show you how to load it.

Here’s an in debt vignette on simple features: https://r-spatial.github.io/sf/articles/sf1.html

# Install the sf package
install.packages(“sf”)

# Load the package
library(sf)

# Take a look at a dataset that comes with the sf package
nc <- st_read(system.file("shape/nc.shp", package = "sf"))

# View the first few records
head(nc, n = 3)

# View the methods available in the sf package
methods(class = 'sf')

# View the documentation for the st_write function (as an example)
?st_write