WHY THIS LAB
Know the evidence before asking it to speak.
Real policy datasets arrive with definitions, coverage gaps, aggregate units, and missing values. This lab slows the first encounter down. You will learn enough about two indicators to recognize when later code or an agent makes an unsupported assumption.
Goals
- 01Translate a broad policy interest into a descriptive or associational question.
- 02State the unit of observation and country-year key.
- 03Inspect types, ranges, years, coverage, and missingness in R.
- 04Use the indicator dictionary to verify names, codes, and units.
- 05Test one agent explanation against the file.
Why an inventory comes before analysis
When analysts move directly to a graph, missing definitions become hidden assumptions. A country-year file may include territories, aggregates, indicators measured in different units, and years with sharply different coverage. Writing an inventory forces those features into the open while the cost of changing direction is still low.
The common teaching file also gives a mixed-experience room a shared reference point. Beginners can practice a small set of inspection commands. Experienced students can write stronger assertions or reusable summaries. Both groups still have to answer the same substantive questions about what is observed and what remains unknown.
If you are new to R, run the supplied commands one at a time and explain each result in ordinary language. If you are experienced, turn the same questions into reusable checks or a small function. The destination is identical: a defensible account of the data—not the longest script or the fastest finish.
Done when. You can describe the question, unit, variables, coverage, missingness, and one limitation without asking an agent, and you have classified one agent claim as confirmed, contradicted, or unresolved.
0-35 MINUTES
Frame, inspect, record.
Select health, gender, access, or climate and identify two indicators.
Name the population, outcome, comparison, and years without causal language.
Run structural, range, coverage, and missingness checks.
Verify each selected indicator against the dictionary.
Complete the six-part evidence inventory.
Predict before run. Before each command, write which part of the object may change: rows, columns, values, ordering, or nothing. If you cannot predict an exact number, predict the direction or shape of the result. This makes the output feedback about your mental model rather than a number to copy.
library(tidyverse)
wdi <- read_csv(
"data/derived/math-camp-wdi-2000-2022.csv",
show_col_types = FALSE
)
glimpse(wdi)
count(wdi, year)
summarise(wdi, economies = n_distinct(iso3c))
stopifnot(!anyDuplicated(wdi[c("iso3c", "year")]))
wdi |>
summarise(
observed = sum(!is.na(under5_mortality)),
missing = sum(is.na(under5_mortality)),
minimum = min(under5_mortality, na.rm = TRUE),
maximum = max(under5_mortality, na.rm = TRUE)
)Replace the final indicator with the outcome for your track. Predict which values can change before running.
Your six-part evidence inventory
| Element | Write a complete answer |
|---|---|
| Question | Population, outcome, comparison, and period. |
| Unit and key | What one row represents and what makes it unique. |
| Outcome | Friendly name, official code, unit, and observed range. |
| Comparison | Friendly name, official code, unit, and observed range. |
| Coverage | Years, observed counts, and missing counts. |
| Limitation | One specific reason the file cannot answer the full policy question. |
No-agent checkpoint. Before opening an agent, each person in the group must be able to explain one row, distinguish zero from missing, and show the command that verifies the key.
35-45 MINUTES
Ask for an explanation, not a rescue.
Give the agent only the public project context needed for this bounded task. Do not ask it to choose the policy question or complete the inventory. Keep this first interaction read-only so you can focus on whether its explanation is grounded rather than on reviewing edits.
Goal: Explain the selected R inspection block to a student who is new to programming. Context: Read the selected code, the wide teaching file, and the indicator dictionary in this project. Constraints: Do not edit files. Explain each object and function in plain language. Separate facts found in files from inferences. Do not make a causal policy claim. Done when: I can state the unit, key, row count, year coverage, variable units, and purpose of each line, and every numerical claim includes an R check I can run.
Read the response once without changing your inventory. Circle one claim that seems important and one claim that seems uncertain.
45-55 MINUTES
Make the explanation earn your trust.
- 01Choose one numerical or structural claim from the agent response.
- 02Write the R command or dictionary lookup that can test it.
- 03Run the check yourself.
- 04Classify the claim as confirmed, contradicted, or unresolved.
- 05Record what the agent assumed that the files did not establish.
Peer exchange
Trade inventories with another policy track. The reader gets three minutes to answer: What is one row? What are the two indicators and units? What is the strongest limitation? If the reader cannot answer, revise the inventory rather than explaining it aloud.
- □The question is descriptive or associational.
- □The key is stated and tested.
- □Indicator codes and units match the dictionary.
- □Missing is not treated as zero.
- □The agent claim has a visible verification result.
55-60 MINUTES
Share the most useful uncertainty.
Each working group offers one sentence in response to one of these prompts:
Name the code or dictionary evidence.
Explain why it seemed plausible.
Name the source or check needed next.
Explain the question it answers.
Optional high-ceiling extension
Create a compact function that accepts an unquoted indicator column and returns observed count, missing count, minimum, maximum, first observed year, and last observed year. Test it on both indicators in your policy track and inspect whether the ranges are substantively plausible.
What to keep. Save your own script or notebook and the six-part inventory. It is not graded or submitted. Lesson 2 will use it to build a documented analysis table.