Skip to contents

cl_term_to_code() maps SDTM terminology codelists' terms to respective C-codes. For mapping terms other than those representing codelists, use term_to_code() instead.

Usage

cl_term_to_code(term)

Arguments

term

A SDTM controlled terminology term referring to a codelist.

Value

A character vector of SDTM codes for codelists. The number of elements returned matches the number of elements in term, i.e. there is a one-to-one correspondence between input and output. Invalid codes in term are mapped to NA.

See also

See cl_code_to_term() for the inverse operation.

Examples

cl_term_to_code(term = "SEX")
#> [1] "C66731"

# `term` is vectorized.
cl_term_to_code(term = c("SEX", "SIZE"))
#> [1] "C66731" "C66733"

# Invalid codes (e.g. `"YODA"`) map to `NA`.
cl_term_to_code(term = c("SEX", "SIZE", "YODA"))
#> [1] "C66731" "C66733" NA