Intro to Spatial Data
This workshop borrows largely from Noli Brazil’s class CRD 230: Spatial Methods in Community Research
This workshop will cover some useful packages to wrangle and visualize spatial data. Specifically, we will learn how to pull in data from a few different sources, set a Coordinate Reference System, and create a map.
The example here mostly works with vector data, which is characterized by real world objects like a tree, building, forest, etc. The two main packages that deal with vector data in R:
sp: the original spatial package in R (first released in 2005) that has a complex data structure
sf: much newer, so not as well established as sp, but it is easier to use than sp and is tidy friendly
SF stands for “simple feature”. It sees any real-word object (or vector) as a feature and a feature can have both a geometry of where the feature is located and attributes associated with it. For example, a county is a feature with a polygon shape and can have attributes like population, number of hospitals, etc. associated with it. Another example could be a UC Davis, which would have a point geometry.
Although, this workshop mostly covers vector data, it will also touch on another type of spatial data called raster data. Raster data is made up of pixels/cells that form a grid filled with information, that is typically continuous in nature (e.g., elevation temperature, land use).