Class 7 — Data Wrangling with dplyr
Part II
Fix what you diagnosed last class — chain filter(), mutate(), group_by(), and summarize() into a single pipeline that collapses your own pilot data into a condition-level summary table.
PART II · CLASS 7
Last class you read your own pilot data into R and found something messy about it. Today you fix it. Working first on an instructor sample dataset and then on your own HW3 file, you’ll chain filter(), mutate(), group_by(), and summarize() into one readable pipeline that turns trial-level data into a clean, condition-level summary table — the same table HW4 asks you to produce on your own.
Reading due: Data Skills ch. 3; R4DS ch. 3 · Due today: —
What you’ll be able to do
- Use
filter()to keep only the rows that satisfy a logical condition (e.g., excluding practice trials or missing responses), building on theread_csv()/glimpse()fluency from Class 6. - Use
mutate()to create or clean up a column (e.g., an accuracy indicator, a standardized participant-ID column) without changing the number of rows. - Use
group_by()andsummarize()together to collapse trial-level data into a condition-level summary (mean RT, accuracy proportion per condition). - Chain multiple dplyr verbs with the pipe (
|>or%>%) into a single readable pipeline. - Sanity-check a summarized result against a partner’s independently-produced summary of a different dataset, building the habit of verifying wrangling output rather than trusting it blindly.