fct_infreq results in decreasing order, closes #948

This commit is contained in:
Mine Çetinkaya-Rundel 2022-05-09 13:31:21 -04:00
parent 564d2be645
commit 7dbe3f9487
1 changed files with 2 additions and 2 deletions

View File

@ -274,8 +274,8 @@ ggplot(by_age, aes(age, prop, colour = fct_reorder2(marital, age, prop))) +
labs(colour = "marital")
```
Finally, for bar plots, you can use `fct_infreq()` to order levels in increasing frequency: this is the simplest type of reordering because it doesn't need any extra variables.
Combine it with `fct_rev()` if you want the largest values on the right, not the left.
Finally, for bar plots, you can use `fct_infreq()` to order levels in decreasing frequency: this is the simplest type of reordering because it doesn't need any extra variables.
Combine it with `fct_rev()` if you want them in increasing frequency so that in the bar plot largest values are on the right, not the left.
```{r}
#| fig.alt: >