Download the tutorial file, knit it to see the complete analysis, then run it chunk by chunk to understand each step.
In this lab you will take the Economic Hardship Index from Lab 1 and apply advanced cartographic techniques: comparing classification methods, building bivariate choropleths, creating interactive GPU-rendered maps, and producing publication-quality figures with scale bars and north arrows.
The tutorial walks through every step with fully working code. Knit it first to see the finished product, then go back and run chunk by chunk to understand how it works.
biscale packagemapgl map with tooltips, hover effects, and GPU-rendered tilesCreate this folder structure before downloading anything. Move the downloaded .qmd into PAF516/Lab2/ before opening it in RStudio.
PAF516/
Lab1/ ...
Lab2/
Lab2_Tutorial.qmd ← downloaded tutorial (do not edit)
Lab2_Tutorial.html ← auto-generated when you knit
Lab2_Assignment_Howell.qmd ← your renamed assignment copy
Lab2_Assignment_Howell.html ← submit this to Canvas
Lab3/ Lab4/ ...
Lab2_Tutorial.qmd in RStudiopackages chunk (labeled #| label: packages)renv block only runs once automaticallyThe lab pulls live data from the Census Bureau. If you don't have a key yet:
census_api_key("YOUR_KEY_HERE", install = TRUE)Click the Render button (blue arrow, top of editor) or press Cmd+Shift+K / Ctrl+Shift+K. This produces Lab2_Tutorial.html with all results — classification comparison maps, bivariate choropleths, and the interactive mapgl map. Review the output to see what the completed analysis looks like.
Place your cursor inside any code chunk and press the run shortcut. Output appears inline. Fix any errors before moving on. This is how you understand what each step does.
| Action | Mac | PC |
|---|---|---|
| Run current chunk | Cmd+Return | Ctrl+Enter |
| Run all chunks above | Cmd+Option+P | Ctrl+Alt+P |
| Knit / Render | Cmd+Shift+K | Ctrl+Shift+K |
| Step | What It Does |
|---|---|
| Step 1 | Pull Census data and build the hardship index at the block group level (Maricopa County) |
| Step 2 | Compare four classification methods (quantile, Jenks, equal interval, standard deviation) as a 2×2 small-multiple grid |
| Step 3 | Create a bivariate choropleth mapping hardship × percent minority using biscale |
| Step 4 | Build an interactive mapgl map of Maricopa County block groups with tooltips and hover effects |
| Step 5 | Create a publication-quality map with scale bar and north arrow using ggspatial |
| Step 6 | Explore the Modifiable Areal Unit Problem (MAUP) with an interactive US county hardship map |
Right-click → Save Link As. Save directly to your PAF516/Lab2/ folder. Do not open in the browser.