reorder_levels: Order levels of factor columns using fct_reorder

View source: R/reorder_levels.R

reorder_levelsR Documentation

Order levels of factor columns using fct_reorder

Description

Order levels of factor columns using fct_reorder

Usage

reorder_levels(
  data,
  cols = c("group", "facet_x", "facet_y"),
  y = "y",
  .desc = rep(TRUE, length(cols))
)

Arguments

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 cols.

Value

A data.frame.

Examples

str(ezplot:::reorder_levels(mtcars, "cyl", "1"))
str(ezplot:::reorder_levels(mtcars, "cyl", "1", FALSE))
str(ezplot:::reorder_levels(mtcars, "cyl", "mpg"))

ezplot documentation built on Aug. 12, 2022, 1:07 a.m.