Skip to content

Instantly share code, notes, and snippets.

@ctufts
Last active June 24, 2016 14:37
Embed
What would you like to do?
Group by , summarise, sort on summary data, append ranking from the sorting - dplyr
ds %>% group_by(group1, group2) %>%
summarise(
summary_value = some_function
) %>% arrange(desc(summary_value)) %>% group_by(group1) %>%
mutate(rank=row_number())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment