View source: R/reorder_levels.R
reorder_levels | R Documentation |
Order levels of factor columns using fct_reorder
reorder_levels(
data,
cols = c("group", "facet_x", "facet_y"),
y = "y",
.desc = rep(TRUE, length(cols))
)
data |
A data.frame. |
cols |
Names of columns to reorder. |
y |
Numeric column for order priority. |
.desc |
A logical vector of length 1 or ncol(data). Default is TRUE for
all columns in |
A data.frame.
str(ezplot:::reorder_levels(mtcars, "cyl", "1"))
str(ezplot:::reorder_levels(mtcars, "cyl", "1", FALSE))
str(ezplot:::reorder_levels(mtcars, "cyl", "mpg"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.