% " /> % " /> % "/>

I typed all the codes well, but only the group_by function doesn't work

47 views Asked by At
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

0

There are 0 answers