fct_inorder: Reorder factors levels by first appearance or frequency

Description Usage Arguments Examples

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)


Search within the forcats package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.