rename_factor: Rename a factor.

View source: R/forcats-like.R

rename_factorR Documentation

Rename a factor.

Description

Renames the levels of a factor.

Usage

rename_factor(.f, ..., reorder = F)

Arguments

.f

A factor or vector (if .f is not yet a factor, it is made one)

...

Dictionaryish arguments, named by old level, value is new level ("old level" = "new level"). You can pass single named arguments, or named vectors or named lists, which will be spliced.

reorder

Logical: If True, the levels will additionally be reordered in the order of first appearance in the arguments

Value

A renamed and reordered factor

See Also

rename_reorder_factor, order_factor_by, forcats::fct_recode, forcats::fct_relevel


tidytidbits documentation built on March 18, 2022, 6:10 p.m.