Week 3
Transforming data with {dplyr}
weeks
Overview
This week includes a review of data visualization and mapping with {ggplot}
review, an introduction to data transformation with {dplyr}
, and an initial discussion of using {dplyr}
with sf
objects.
Key Objectives
- Review the concept of “tidy”, analysis-friendly data
- Introduce the “verbs” of data wrangling with
{dplyr}
- Practice subsetting rows with
dplyr::filter()
ordplyr::slice()
- Practice subsetting columns with
dplyr::select()
- Practice using
{tidyselect}
helpers includingwhere()
,all_of()
,any_of()
, andstarts_with()
- Practice creating new variables with
dplyr::mutate()
ordplyr::summarise()
Prepare
Required readings
- Ch. 3 Data Structure in Crystal Lewis Data Management in Large-Scale Education Research, 1st ed. (Chapman & Hall, 2024), https://datamgmtinedresearch.com/.
- Ch. 5 Data transformation 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. 3 Attribute data operations in Robin Lovelace, Jakub Nowosad, and Jannes Muenchow Geocomputation with R, 2nd ed. (CRC Press, 2025), https://r.geocompx.org.
Optional readings
- Ch. 5 Attributes and Support in Edzer Pebesma and Roger Bivand Spatial Data Science (CRC Press, 2023), https://r-spatial.org/book/.
- dplyr base R vignette for the
{dplyr}
package comparing dplyr functions to their base R equivalents.
Participate
Practice
🛠️️ Exercise 03