I am trying to make a graph with ordered bars according to frequency and also using a variable two separate two variables using facets. Words have to be ordered by value
The very relevant comment aside by GordonShumway (because the solution offered there is a little black magicky) - you can create a temporary value to reorder your facet - note I'm using forcats::fct_reorder rather than reorder
library(tidyverse)
d %>%
mutate(temp = paste0(word, u_c)) %>%
ggplot(aes(x = fct_reorder(temp, n), y = n, fill = u_c)) +
geom_col(show.legend = F) +
facet_wrap(~u_c, scales = "free_y") +
coord_flip()