Session Ready
Exercise

Spread rows into columns

In this exercise, you'll use the tidyr, dplyr, and readr packages to tidy the ratings2 data after using dplyr::count(). The tidy_ratings_all data should have four variables to work with:

  • series (integer: 1-8),
  • episode (integer: 1-10),
  • days (integer: 7 or 28), and
  • viewers (numeric).
Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Start by gathering all columns that end with "day" into two columns: episode and viewers. Separate the key column into two columns named episode and days. Both of these two separated columns need to be parsed as numbers also, within a mutate.