05. Tidying, Reshaping, and Ingesting Data
This week …
More on dplyr: using across() to apply functions to multiple columns at once; using case_when() to create new variables based on conditions; reshaping data with pivot_longer(); importing and cleaning your data from plain-text and foreign binary formats.
Required Reading
- Karl W. Broman and Kara H. Woo “Data Organization in Spreadsheets,” The American Statistician 72, no. 1 (January 2, 2018): 2–10, doi:10.1080/00031305.2017.1375989.
- Hadley Wickham, Garrett Grolemund, and Mine Çetinkaya-Rundel R for Data Science: Import, Tidy, Transform, Visualize, and Model Data, 2nd ed. (Sebastopol, CA: O’Reilly Media, 2023), https://r4ds.hadley.nz. Read Chapter 7 on importing data. Read Chapter 20 on Spreadsheets. Read or review Chapter 17 on dates and times.
tidyr
- Tidy data
- Pivoting
- (Optional.) Rectangling
stringr
- Regular expressions
- Read the help page for
str_detect():?stringr::str_detect, which can also be found here. Work through the examples one at a time and make a note of any that seem confusing.