Assignment 5 Walkthrough and Reference
Where this fits
You have the worked example, the failure modes, the prompt templates, and the studio drafts. This page is the bridge from in-class work to the Assignment 5 submission. The deliverables listed here are the same set in the A5 README — this page explains what goes into each one and how to verify it.
Deadline and link to M1
Assignment 5 is due the Monday after Week 6 class, 4 PM. The Milestone 1 (Project Proposal) initial-visual-plan.md is due the same Monday. The two pieces of work share a standard of transparency, but they are different artifacts: A5 polishes a plot from the NHANES classroom CSV; M1 sketches one planned figure for your team’s project. Do not conflate them.
How the audit habit carries into your M1 proposal
The five audit categories you practiced in viz06 map directly onto the evidence and claims in your M1 proposal:
- Correctness: the claims in your proposal must match what your chosen dataset can actually show.
-
Design: the planned figure in
initial-visual-plan.mdshould name the statistic and the comparison, not just promise “a chart.” - Interpretation: write proposal claims as descriptive (“we will describe…”) rather than causal (“we will show X causes Y”).
- Bias and aggregation: say which groups in your dataset may be small or missing, and how your team will disclose that.
- Reproducibility: commit to relative paths and rerunnable code from the first proposal draft.
Your m1-link-note.md (deliverable 6 below) is where you record this connection in your own words.
The seven A5 deliverables, explained
Each file goes in assignments/assignment05-visualization/submission/.
1. visualization-audit.qmd
A rerunnable Quarto file that loads the cached CSV with a relative path, prepares a descriptive summary, renders the final corrected plot, and includes one or two short paragraphs explaining what you revised and why.
- Verify: open it in a fresh Codespace, render top to bottom, no errors.
2. visualization-audit.html
The rendered output of the .qmd above. Quarto writes this when you click Render.
- Verify: open the HTML in the Codespaces preview and confirm the figure, caption, and audit paragraph all appear.
3. corrected-plot.png
The exported corrected plot as a static image, written from code rather than by screenshot.
To save your corrected ggplot, use:
Confirm the file appears in the submission folder before committing.
Step by step:
- Run the code that draws your corrected plot, so it is the most recent figure in your session.
- Run the
ggsave()call above.plot = last_plot()means “the most recent ggplot I drew.” If you stored the plot in a variable, pass that instead:plot = my_corrected_plot. - The path starts from the repository root, so run it from there. If your R session is already inside the submission folder, shorten the path to
"corrected-plot.png". - Check the result in VS Code: find the PNG in the Explorer panel, right-click it, and choose Open Preview to confirm it opens and looks right.
- Verify: the PNG exists, opens, and matches what the rendered HTML shows.
4. visual-audit-note.md
A short note listing at least three issues you identified in the flawed plot from viz06. For each issue, write one sentence on what it was, one sentence on why it matters, and one sentence on how you corrected it.
- Verify: three issues, each tagged with a category from viz04 (correctness, design, interpretation, bias/aggregation, or reproducibility).
5. caption.md
The caption for your final figure. Use the template from viz03:
This figure shows [measure] by [group] across [time/category] using the prepared NHANES Health Equity classroom dataset. The summary is descriptive and unweighted. Records with missing [variables] were excluded. The plot supports comparison of patterns, not causal claims or population-level estimates.
- Verify: the caption names the statistic, the data source, the exclusions, and one limitation.
6. m1-link-note.md [brief — 1-3 focused bullets or sentences are enough]
Two or three sentences connecting the visualization standard from this assignment to your M1 visual plan. What did this assignment change about the figure your team plans to make? Did it change your dataset choice, the exclusions you will document, or the caption your team will write?
- Verify: the note is specific to your team’s project, not generic advice.
7. ai-use-note.md
If you used AI to draft code or wording, name what it helped with and how you verified the result. If you did not use AI, write one sentence saying so.
Copy your inline # AI prompt: / # Verified: comment pairs into the note’s audit trail. The template and a filled example are on the assignments index.
- Verify: specific (which chunk? which prompt template?), not vague (“I used Copilot”).
Reproducibility checklist for A5
Before you click submit:
- The
.qmdrenders in a fresh Codespace with no manual edits. - The data path is relative (
examples/nhanes-equity/data/nhanes_equity_v6.csv). - The PNG is generated by code (or a documented render step), not by screenshot.
- The caption uses the descriptive template and does not imply causality or national prevalence.
- Use the course devcontainer packages. If an additional package was approved, record it in your dependency note and the workspace setup so a fresh Codespace can install it.
- All seven files are committed and pushed to your GitHub repo.
Accessibility (good practice, not a graded deliverable)
A plain-language alt text sentence next to your figure helps screen-reader users, colour-blind reviewers, and busy policymakers. The A5 rubric does not score alt text — it is encouraged practice. If you want to try it, add fig-alt: as a chunk option:
ggplot2 quick reference
| Need | Code | Note |
|---|---|---|
| Load packages | library(tidyverse) |
Every session |
| Set data + mapping | ggplot(df, aes(x, y)) |
The starting point |
| Points | geom_point() |
Use alpha for overlap |
| Lines connecting summaries | geom_line() + geom_point() |
Better than geom_smooth() for descriptive cycle data |
| Bars / columns | geom_col() |
For pre-aggregated counts |
| Labels | labs(title, subtitle, x, y, caption) |
Caption goes under the figure |
| Honest y-axis | expand_limits(y = 0) |
Start at zero unless you justify otherwise |
| Theme | theme_minimal() |
Clean default |
| Save figure | ggsave("plot.png", plot, width = 6, height = 4) |
Code-generated, not screenshot; for A5 use the full submission-folder path (see deliverable 3) |
Visual audit checklist
A short version of the five questions from viz04:
- Title and caption do not imply causation.
- Y-axis starts at 0 or has a stated reason.
- Geometry suits descriptive data (no smoother across categorical x).
- Weighted vs unweighted is stated.
- Missingness and exclusions are disclosed.
- Small-cell counts are visible or filtered out.
Five quick knowledge checks
- What are the five moving parts of a ggplot?
- Name two failure modes from viz04 and one fix for each.
- Why is
geom_smooth(method = "lm")rarely appropriate for NHANES cycle data? - What two lines of comment should appear above any AI-drafted chunk?
- What is the difference in scope between Assignment 5 and the M1
initial-visual-plan.md?
Where this goes next
Next week (Week 7) builds the EDA evidence behind the descriptive claims you have been plotting: cohort definition, missingness reporting, Table 1, and the AI audit categories.