Tidying Data with tidyr
Transform messy data into a tidy format to facilitate analysis using tidyr functions.
1
Introduction to Tidying Data with tidyr
The tidyr package helps in organizing messy data into a structured format.

2
Pivoting Data: Wide to Long
Use pivot_longer() to convert wide format data to long format.
library(tidyr)
data <- data.frame(Name = c('Alice', 'Bob'), Jan = c(10, 15), Feb = c(20, 25))
data_long <- pivot_longer(data, cols = c('Jan', 'Feb'), names_to = 'Month', values_to = 'Score')All lessons in this course
- Introduction to Tidyverse
- Data Wrangling with dplyr
- Tidying Data with tidyr