Assignment 7/8: Spatial Data
Description
This a double assignment (7 & 8). The goal is to gain practice creating maps to show data. It is due April 21.
Document Setup
For this assignment, create an HTML document using Quarto. You can refer to the homepage.qmd document we created in class for some ideas.
- Make sure your YAML header has:
- The option
embed-resources: true- This goes under the html: format option.
- It will make sure the HTML file stands alone, rather than referring to an external figure. I won’t be able to see your figure if you upload and HTML file without this option.
- The option
- I want to see the code chunks that create your figure, so make sure you use
#| echo: truein your R code chunk.- You may use code folding (
#| code-fold: true) if you’d like.
- You may use code folding (
Instructions
- Find a dataset. It can be explicitly spatial (containing coordinates) or it can just refer to spatial units (e.g., data for particular states or counties). If it’s explicitly spatial, it can be raster or vector data. If it’s implicitly spatial, you’ll probably want to join it to some vector data (e.g., to polygon state boundaries).
- Write a small amount of narrative in your Quarto document about the dataset and why you want to make a particular visualization. Don’t spend a lot of time on the narrative.
- Plot! or rather… map! I’m asking for two independent maps, but each one can have multiple panels if your heart desires.
- Recall, both
sfandterrahave base Rplot()methods. - Recall,
ggplot2can plotsfobjects. Rasters are easy to plot withas.data.frame(..., xy = TRUE). - Include some context on your map. Borders, cities, placenames, etc.
- Check the Resources page for some help/ideas. There are tons of other resources for plotting spatial data in R online. I welcome suggested additions to the Resources page!
Let me know if you have any questions!