Tidy Data with tidyr
1 Lecture
2 Exercises
2.1 Exercise 1: Tidy up the penguins!
The datasets 03_penguins_messy_2007.csv, 03_penguins_messy_2008.csv, and 03_penguins_messy_2009.csv represent an untidy version of the penguin dataset that you already saw.
First, have a look at the data sets. What are the variables and the observations in these three tables? Think about this question before you start coding.
Please tidy up the three tables and convert them into a single tidy dataset.
You will need functions from this session and the session on vectors and tables.
3 Extra exercise 2: Religion and income
Have a look at the relig_income data set that is included in tidyverse package. The data set contains the results of a survey asking people about their religion and income category. The cells report the no. of survey participants with a certain religion and income range.
See ?relig_income for details. Do not forget to load the tidyverse package so that the dataset is avaiable.
What is not tidy about this data set? Can you fix it?