fct_reorg | R Documentation |
fct_reorg()
is a forcats hack that reorganizes a factor after re-leveling it. It has been
situationally useful in my coefficient plots over the years.
fct_reorg(fac, ...)
fac |
a character or factor vector |
... |
optional parameters to be supplied to forcats functions. |
Solution comes by way of this issue on Github: https://github.com/tidyverse/forcats/issues/45
This function takes a character or factor vector and first re-levels it before re-coding certain values. The end result is a factor.
x<-factor(c("a","b","c"))
fct_reorg(x, B="b", C="c")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.