powered by
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)) )
A data.frame.
Names of columns to reorder.
Numeric column for order priority.
A logical vector of length 1 or ncol(data). Default is TRUE for all columns in cols.
cols
str(ezplot:::reorder_levels(mtcars, "cyl", "1")) str(ezplot:::reorder_levels(mtcars, "cyl", "1", FALSE)) str(ezplot:::reorder_levels(mtcars, "cyl", "mpg"))
Run the code above in your browser using DataLab