reorder_levels {ezplot}R 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"))

[Package ezplot version 0.7.13 Index]