Lab 17: tidyr

Note

In lab.qmd ## Lab 17 section,

trump_data
# A tibble: 2,702 × 4
   subgroup date       approval disapproval
   <chr>    <date>        <dbl>       <dbl>
 1 Voters   2020-10-04     44.7        52.2
 2 Adults   2020-10-04     43.2        52.6
 3 Adults   2020-10-03     43.2        52.6
 4 Voters   2020-10-03     45.0        51.7
 5 Adults   2020-10-02     43.3        52.4
 6 Voters   2020-10-02     44.5        52.1
 7 Voters   2020-10-01     44.1        52.8
 8 Adults   2020-10-01     42.7        53.3
 9 Adults   2020-09-30     42.2        53.7
10 Voters   2020-09-30     44.2        52.7
# ℹ 2,692 more rows
trump_longer <- ______________
    pivot_longer(
        cols = ____________,
        names_to = _______________,
        values_to = _______________
    ) 
# A tibble: 5,404 × 4
   subgroup date       rating_type rating_value
   <chr>    <date>     <chr>              <dbl>
 1 Voters   2020-10-04 approval            44.7
 2 Voters   2020-10-04 disapproval         52.2
 3 Adults   2020-10-04 approval            43.2
 4 Adults   2020-10-04 disapproval         52.6
 5 Adults   2020-10-03 approval            43.2
 6 Adults   2020-10-03 disapproval         52.6
 7 Voters   2020-10-03 approval            45.0
 8 Voters   2020-10-03 disapproval         51.7
 9 Adults   2020-10-02 approval            43.3
10 Adults   2020-10-02 disapproval         52.4
# ℹ 5,394 more rows

BONUS 💵: Use trump_longer to generate a plot like the one below.