Week 9 · Tuesday, Nov 24 · Lecture
| Time | What |
|---|---|
| 1:30 | How to review code (and how to be reviewed) |
| 1:45 | Review, part 1: clone, restore, render |
| 2:00 | Review, part 2: read the runbook and the code |
| 2:25 | Review, part 3: write it, submit it |
| 2:50 | Read the review you got |
| 3:00 | Week 10 |
Learning goals: check that someone else’s project re-runs from a fresh clone; read code for correctness, readability and honesty, not just “does it run”; write feedback that is specific, kind and actionable.
Important
This is the peer review (5%). Written by you, no AI, submitted on Canvas before 3:00 pm today.
Your own repo’s state at 1:30 pm is what gets reviewed. Don’t push during the session; you’ll fix things after reading your review.
| Ask | How to check | |
|---|---|---|
| Runs | Does it render from a fresh clone, with no edits? | git clone, renv::restore(), quarto render run-analysis.qmd |
| Reproducible | Relative paths? Raw data untouched? No hidden state? | Search for /Users/, C:\, setwd, rm(list |
| Readable | Do names say what things are? Comments explain why? Repeated blocks? | Read one script top to bottom; lintr::lint() |
| Correct | Row counts at every join and filter? Missing values decided, and reported? Do the sentences match the tables and figures? | Compare text with output; look for na.omit(), joins without checks |
| Honest | Data sources and licenses? Limitations? “AI use” section? | data/README.md, the end of the runbook |
| AI files | Does AGENTS.md set real boundaries? Does the code follow STYLE.md? |
Read both, then spot-check one script |
Not useful
Looks good! Maybe clean up the code a bit.
Useful: where, what, why, and a fix
R/03-join.R, line 14.na.omit(joined)drops every row with any missing value. In the render, the table goes from 812 to 640 rows, but the runbook doesn’t say so, and the text still says “all 812 respondents”. Suggestion: filter only on the columns the model uses, and report how many rows were dropped with inline code.
Review the code, not the person: “this line drops rows”, not “you forgot”. Kind, specific, actionable. Being reviewed: read it twice before you reply. A reviewer who found a problem saved you from finding it on Dec 3.
On Canvas (graded), and also as one GitHub issue on their repository titled Peer review: <your name>, so the authors can act on it:
stopifnot() after the join caught…”)Graded on how useful it is, not on how many flaws you found. “It ran and I found nothing wrong” is fine if you show how you checked.
⏱ 15 min
renv::restore(), then quarto render run-analysis.qmdDon’t fix their code beyond that one step. Your job is to report, not repair.
⏱ 25 min
Go through the checklist, row by row. Take notes with file and line.
⏱ 25 min
Write your review in the five parts (run, two strengths, two suggestions, one question, weakest row).
No AI, including to “polish” the wording. Your own words, your own judgment.
⏱ 10 min
These fixes go into your final report, which has to say how you used the feedback. The issue is your record.
Happy Thanksgiving. No class Thursday, Nov 26.

STAT 266A · Fall 2026 · UC Santa Cruz