data(murders)
murders_2 <- murders %>%
mutate(rate=total/population*100000) %>%
mutate(idx=case_when(rate < median(rate) ~ "low",
TRUE ~ "high")) %>%
select(state, region, rate, idx) %>%
group_by(idx)
# group_by(idx) is not applicable.
What's the problem?
I hope the results are sorted according to idx