I have this data set called HAPPY, that has multiple different columns (AGE, MARITAL, DEGREE... and so on). I have these columns to be factor variables, and I am trying to rearrange the levels in the factor so they are in an order that makes sense. For example, I am trying to rearrange the MARITAL factors to c("Never Married" "Married "Separated", "Divorced", "Widowed"). I am supposed to use Dplyr to do this. Possibly using arrange, summarize, and group_by. This is what I did, but this is not close at all and I am struggling to figure this out:
HAPPY %>%
group_by(MARITAL) %>%
summarize(n = n(), solo = mean(AGE)) %>%
arrange(desc(solo))
Thanks for your time!
https://xdaiisu.github.io/ds202materials/hwlabs/HAPPY.rds here is the link to the data