Exercise: Reproduce a result from an incomplete handoff#
A colleague gives you a summary but omits a filtering decision and the units. Your job is to produce a handoff another analyst can actually reproduce.
See the shared submission guidance and rubric. Run from book/exercises; the setup below supplies data, not completed answers.
# Shared simulator and small utility functions; no live service is called.
source("../R/course.R")
raw <- simulate_trials(seed=102, n_subjects=18, n_items=24)
# This is the colleague's incomplete analysis, supplied for inspection.
colleague_summary <- aggregate(rt ~ subject, raw[raw$correct == 1, ], mean)
colleague_number <- mean(colleague_summary$rt) / 1000
colleague_number
2. Create a reproducible handoff#
Write a function summarize_trials(data, correct_only) returning the result in milliseconds plus retained trial and participant counts. Add checks for required columns and correct-only eligibility. Keep the function independent of global raw. Test it on a reordered copy; row order should not change the result.
# Define summarize_trials and verify it on original and reordered inputs.
Your explanation and evidence:
3. Write the missing README#
Supply a short handoff specifying synthetic provenance, input columns, units, the exact function call, expected numerical output, software versions, and a limitation. Ask a peer to reproduce it, or conduct a fresh-session self-audit clearly labeled as such. Record any missing instruction you discover.
# Record sessionInfo() and the expected output of your documented call.
Your explanation and evidence:
What to submit#
A reusable summary function, its row-order check, a comparison table, and a reproduction README with a peer or self-audit log. Do not invent a successful peer replication.