Part 26 Tidy Data and Pivoting
library(tidyverse)26.1 Orientation
26.1.1 Today
Today’s concept is tidy data and the tidyr package.
- Reshaping data by pivoting with
tidyr::pivot_longer()andtidyr::pivot_wider().
26.1.2 Resources
For concepts of tidy data:
- Jenny Bryan’s intro to tidy data is short and sweet.
- the repo this links to has some useful exercises too, but uses the older
spread()andgather()functions.
- the repo this links to has some useful exercises too, but uses the older
tidyrvignette on tidy data.- Hadley’s paper on tidy data provides a thorough investigation.
For pivoting with tidyr, check out the pivot vignette.