Spatial Data
Spatial data is any type of data that directly or indirectly references a specific geographical area or location. Sometimes called geospatial data or geographic information.
Best case for mapping spatial data: when geography matters. Do not overuse it.
Graphs
sf and tmap
R Package sf
is for reading shape files (.shp
). To see the read map, use function st_geometry()
and plot the returned object.
R Package tamp
is for plotting maps (generated by sf
) together with other data. The general workflow is
- Get the spatial data by reading the shape file using
sf
- Combine spatial data and other data
- e.g. use
left_join()
- e.g. use
- plot the combined data using
tmap