check.sex: Check and convert the sex variable in a register to a factor

Description Usage Arguments Details Value Author(s) Examples

View source: R/check.sex.R

Description

Checks the domain of the sex variable and returns a factor with levels male and female.

Usage

1
check.sex(sex)

Arguments

sex

Vector indicating sex of the subject

Details

sex is converted to character, then converted to a factor.The Swedish registers encode males as 1 and females as 2—all other values are taken to be missing values and set to NA. A warning is given if missing values are present.

Value

Factor with levels male and female.

Author(s)

Peter Konings

Examples

1
2
sex <- c(1,2,3,NA)
check.sex(sex)

lemna/ugir documentation built on May 21, 2019, 3:07 a.m.