one_factor: Replace two or more factor levels by the first one.

Description Usage Arguments Value Examples

Description

In raw data the same level of a factor variable may be encoded with errors, i.e. misprints. In this case many levels may correspond actually to one true level. This function replaces all mentioned levels by the first one.

Usage

1

Arguments

x

the factor variable with misprints in level names

levels

the levels that should be replaced by one level, levels[1] is used as the replacement.

Value

correctly encoded x

Examples

1
2
x <- c("Male","Female","male","Mle","Female")
unite_factors(x,c("Male","male","Mle"))

bdemeshev/bigr documentation built on May 12, 2019, 3:40 a.m.