Skip to contents

Tidy gender variable

Usage

tidy_sex(x, lang = "zh", as_factor = FALSE)

Arguments

x

Vector contains gender information.

lang

Character, specify the output language, options are 'cn', or 'en', default is 'cn'.

as_factor

Return factor value.

Value

A factor vector contains gender information.

Examples

gender <- c("male", "men", "women", "female", "women", "man", "1", "2")
tidy_sex(gender)
#> [1] 1 1 2 2 2 1 1 2