title: Data Carpentry lesson on tidy data output: html_document: toc: true
toc_depth: 4
This is a lesson on tidying data. Specifically, what to do when a conceptual variable is spread out over 2 or more variables in a data frame.
Data used: words spoken by characters of different races and gender in the Lord of the Rings movie trilogy
- directory of this lesson in the Data Carpentry GitHub repo
- 01-intro shows untidy and tidy data. Then we demonstrate how tidy data is more useful for analysis and visualization. Includes references, resources, and exercises.
- 02-tidy shows how to tidy data, using
gather()from thetidyrpackage. Includes references, resources, and exercises. - 03-tidy-bonus-content is not part of the lesson but may be useful as learners try to apply the principles of tidy data in more general settings. Includes links to packages used.
Learner-facing dependencies:
- files in the
tidy-datasub-directory of the Data Carpentrydatadirectory tidyrpackage (only true dependency)ggplot2is used for illustration but is not mission criticaldplyrandreshape2are used in the bonus content
Instructor dependencies:
curlif you execute the code to grab the Lord of the Rings data used in examples from GitHub. Note that the files are also included in thedatacarpentry/data/tidy-datadirectory, so data download is avoidable.rmarkdown,knitr, andxtableif you want to compile theRmdtomdandhtml