fct_inorder: Reorder factors levels by first appearance or frequency

Description Usage Arguments Examples

View source: R/reorder.R

Description

Reorder factors levels by first appearance or frequency

Usage

1
2
3

Arguments

f

A factor

ordered

A logical which determines the "ordered" status of the output factor. NA preserves the existing status of the factor.

Examples

1
2
3
4
5
6
f <- factor(c("b", "b", "a", "c", "c", "c"))
f
fct_inorder(f)
fct_infreq(f)

fct_inorder(f, ordered = TRUE)

tidyverse/forcats documentation built on Jan. 11, 2019, 11:10 a.m.