Closed BenjaminBoo closed 10 months ago
Good catch.
I forgot to ungroup()
prior to using arrange()
and that resulted in the error.
filter(ay_distance == "Medium") %>%
ungroup() %>%
arrange(-avg_cpoe) %>%
dplyr::slice(1:10)
Adding it, as in the above code, results in the correct output:
passer ay_distance avg_cpoe
<chr> <chr> <dbl>
1 T.Taylor Medium 63.4
2 J.Johnson Medium 51.2
3 B.Allen Medium 44.5
4 R.Wright Medium 40.4
5 J.Driskel Medium 36.4
6 N.Mullens Medium 31.7
7 T.Hill Medium 25.2
8 S.Darnold Medium 19.2
9 B.Rypien Medium 18.0
10 J.Winston Medium 16.1
2.5.4: NFL Data and the mutate() verb. I noticed that the following command includes an "arrange()" verb that should list the values in descending order of avg_cpoe:
airyards_cpoe_mutate %>% filter(ay_distance == "Medium") %>% arrange(-avg_cpoe) %>% slice(1:10)
but in the tibble displayed in the book, and when I copy/paste into RStudio, the tibble is arranged in ascending alphabetical order of passer:
A tibble: 82 x 3 Groups: passer [82] passer ay_distance avg_cpoe