Sortfactors: Re-sort Factor Levels by Frequency

Description Usage Arguments Value Author(s) Examples

Description

Re-sort factor levels by frequency.

Usage

1
Sortfactors(x, decreasing = TRUE)

Arguments

x

the factor variable to be recoded.

decreasing

Boolean. Whether to sort decreasing or not.

Value

the recoded factor variable.

Author(s)

Daniel Marcelino, dmarcelino@live.com.

Examples

1
2
3
4
sex <- rep(c('m','f'), c(4, 2))
table(sex)

table(Sortfactors(sex))

danielmarcelino/SciencesPo documentation built on Oct. 20, 2019, 1:15 a.m.