How to sort descending within filtered dplyr group_by groups?

arrange takes a data.frame / tibble as first argument. You don't have that here, you can't use it directly on a vector. This is a function not for vector like sort. This why you get the error.

2 Likes