decode_sex: Convert Sex Codes to Descriptive Labels

Description Usage Arguments Details Value Author(s) See Also

View source: R/panthr.r

Description

decode_sex formats the SEX field by evaluating a scalar or vector of values with gender codes and missing values. F is converted to Female, M is converted to Male, and NULL values are converted to Not Reported.

Usage

1
decode_sex(code)

Arguments

code

A 1-character SEX code, which may be a scalar value or vector of length n comprised of F, M, or NULL.

Details

Output may be made categorical using function factor or as.factor. This function also allows for easily tallying counts using, e.g., function table.

Values which are not NULL nor contain F or M are coerced to NA.

Value

A scalar or vector of values converted into full-length, descriptive labels or Not Reported if missing.

Author(s)

Jamison R. Crawford, Institutional Research Associate, Georgia State University

See Also

grepl, table


jamisoncrawford/panthr documentation built on March 9, 2020, 6:18 p.m.