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 economic hardship index. You will align coordinate reference systems, compute the distance from every block group to its nearest facility, overlay facility locations on the hardship map, and test the environmental justice hypothesis: do lower-income communities sit disproportionately close to environmental hazards? You will finish with a multi-buffer comparison that shows how the answer depends on the distance threshold you choose (the Uncertain Geographic Context Problem, UGCoP).
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 objects with an aligned CRSst_distance()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 — facility overlay maps, the distance-decay table and charts, and the multi-buffer comparison. 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 from the 2015–2019 ACS |
| Step 2 | Build the 5-variable economic hardship index with z-score standardization |
| Step 3 | Load external point data (environmental facility locations) |
| Step 4 | Convert point data to sf and align coordinate reference systems |
| Step 5 | Compute distance from each block group centroid to the nearest facility with st_distance() |
| Step 6 | Facility overlay map and distance-to-nearest-facility choropleth |
| Step 7 | Distance-decay analysis — mean hardship and poverty by distance band (the EJ finding) |
| Step 8 | Multi-buffer UGCoP comparison — inside vs. outside 0.5-, 1-, and 2-mile buffers |
Right-click → Save Link As. Save directly to your PAF516/Lab3/ folder. Do not open in the browser.