Hi - I'm pretty sure I need to reorder the factor that's filling the bars before I pipe into ggplot, but I can't get it to work. Without having to manually reorder the factor levels, how can I have the bar segments be ordered in a consistent way? i.e. the highest value of
marital being the bottom bar for each grouping of
race. Thank you!
forcats::gss_cat %>% count(race,marital) %>% mutate(marital=fct_reorder(marital,n)) %>% ggplot(aes(race,n,fill=marital))+ geom_col(position = 'fill')