I would like to solve this error.
My code is:
data<- data%>%
group_by(distritID) %>%
arrange(desc(var), .by_group = TRUE)
Error in order(desc(var), by_group = TRUE) : argument lengths differ
How can I make it work? I would like to order from max to min value from column Var, bur for each distritID.
Thanks!
CodePudding user response:
Try this:
library(dplyr)
data %>%
arrange(distritID, desc(var))