fct_infreq results in decreasing order, closes #948
This commit is contained in:
parent
564d2be645
commit
7dbe3f9487
|
@ -274,8 +274,8 @@ ggplot(by_age, aes(age, prop, colour = fct_reorder2(marital, age, prop))) +
|
||||||
labs(colour = "marital")
|
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.
|
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 the largest values on the right, not the left.
|
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}
|
```{r}
|
||||||
#| fig.alt: >
|
#| fig.alt: >
|
||||||
|
|
Loading…
Reference in New Issue