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 integrate external point data (environmental facility locations) with your block-group-level hardship index using spatial joins and buffer analysis. You will test whether hardship scores change across geographic scales (ICC), overlay environmental hazard sites onto the hardship map, and build an enriched index that combines census-based hardship with proximity to environmental facilities.
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.
sf spatial objectsst_join()st_buffer()Create this folder structure before downloading anything. Move the downloaded .qmd into PAF516/Lab3/ before opening it in RStudio.
PAF516/
Lab1/ Lab2/ ...
Lab3/
Lab3_Tutorial.qmd ← downloaded tutorial (do not edit)
Lab3_Tutorial.html ← auto-generated when you knit
Lab3_Assignment_Howell.qmd ← your renamed assignment copy
Lab3_Assignment_Howell.html ← submit this to Canvas
Lab4/ Lab5/ ...
Lab3_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 Lab3_Tutorial.html with all results — ICC tests, spatial joins, buffer maps, and enriched index comparisons. 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 Maricopa County block group data and build the 5-variable hardship index |
| Step 2 | Build the hardship index with z-score standardization |
| Step 3 | Test aggregation sensitivity with the Intraclass Correlation Coefficient (ICC) |
| Step 4 | Load external point data (environmental facility locations) |
| Step 5 | Convert point data to sf and align coordinate reference systems |
| Step 6 | Point-in-polygon spatial join with st_join() |
| Step 7 | Buffer analysis — create 1-mile proximity zones around facilities |
| Step 8 | Build an enriched hardship index integrating environmental proximity |
| Step 9 | Comparative maps: original vs. enriched hardship index |
Right-click → Save Link As. Save directly to your PAF516/Lab3/ folder. Do not open in the browser.