Week 7
Writing functions and pipelines
weeks
Summary
This week is a more detailed look at functions as a key element of building reproducible data analysis pipelines.
Overview
Key Objectives
- Introduce process of refactoring code to write functions
- Practice naming functions and adding comments to functions
- Introduce the concept of reproducible data analysis pipelines
Prepare
Required readings
- Ch. 26 Functions in Hadley Wickham, Garrett Grolemund, and Mine Çetinkaya-Rundel R for Data Science: Import, Tidy, Transform, Visualize, and Model Data, 2nd edition. (Sebastopol, CA: O’Reilly Media, 2023), https://r4ds.hadley.nz/.
- Ch. 11 Scripts, algorithms and functions in Robin Lovelace, Jakub Nowosad, and Jannes Muenchow Geocomputation with R, 2nd ed. (CRC Press, 2025), https://r.geocompx.org.
- Ch. 29 Quarto in Wickham, Grolemund, and Çetinkaya-Rundel R for Data Science.
Optional readings
- Sam Leon “Accounting for Methods: Spreadsheets, Scripts and Programming Notebooks,” in The Data Journalism Handbook: Towards A Critical Data Practice, ed. Liliana Bounegru and Jonathan Gray, 2nd ed. (Amsterdam University Press, 2021), 128–137, doi:10.2307/j.ctv1qr6smr.
- Welcome to Quarto Workshop! (Posit PBC, 2022), https://www.youtube.com/watch?v=yvi5uXQMvu4.
Participate
Practice
Details on week 7 exercise to be provided.