Clean and chart a dataset in R
8 steps · about 5 h 15 min · Beginner
- Learn R's basic syntax and objects (guide, R for Data Science (Wickham, Cetinkaya-Rundel, Grolemund), 20 min)
Assignment, function calls and naming come first so later code makes sense.
- Read a CSV into a data frame (guide, R for Data Science (Wickham, Cetinkaya-Rundel, Grolemund), 40 min)
Real analysis starts with getting messy files in and fixing column types.
- Filter, sort and summarise rows with dplyr (guide, R for Data Science (Wickham, Cetinkaya-Rundel, Grolemund), 1 h)
The dplyr verbs answer most everyday questions about a dataset.
- Reshape data into tidy form (guide, R for Data Science (Wickham, Cetinkaya-Rundel, Grolemund), 45 min)
Pivoting wide and long data unlocks both summaries and charts.
- Chart the cleaned data with ggplot2 (guide, R for Data Science (Wickham, Cetinkaya-Rundel, Grolemund), 50 min)
With tidy data in hand, a layered grammar of graphics makes charts quick to iterate.
- Keep pipelines readable (guide, R for Data Science (Wickham, Cetinkaya-Rundel, Grolemund), 20 min)
Consistent style and the pipe keep growing analysis scripts maintainable.
- Wrap repeated steps in functions (guide, R for Data Science (Wickham, Cetinkaya-Rundel, Grolemund), 45 min)
Functions remove copy-paste once you repeat the same cleaning on several columns.
- Publish the analysis as a Quarto report (guide, R for Data Science (Wickham, Cetinkaya-Rundel, Grolemund), 35 min)
Ending with a reproducible report turns code into something you can share.