ct_map | R Documentation |
ct_map()
recodes a vector following a controlled terminology.
ct_map(
x,
ct_spec = NULL,
ct_clst = NULL,
from = ct_spec_vars("from"),
to = ct_spec_vars("to")
)
x |
A character vector of terms to be recoded following a controlled terminology. |
ct_spec |
A tibble providing a controlled terminology specification. |
ct_clst |
A character vector indicating a set of possible controlled
terminology codelists codes to be used for recoding. By default ( |
from |
A character vector of column names indicating the variables containing values to be matched against for terminology recoding. |
to |
A single string indicating the column whose values are to be recoded into. |
A character vector of terminology recoded values from x
. If no
match is found in the controlled terminology spec provided in ct_spec
, then
x
values are returned in uppercase. If ct_spec
is not provided x
is
returned unchanged.
# A few example terms.
terms <-
c(
"/day",
"Yes",
"Unknown",
"Prior",
"Every 2 hours",
"Percentage",
"International Unit"
)
# Load a controlled terminology example
(ct_spec <- read_ct_spec_example("ct-01-cm"))
# Use all possible matching terms in the controlled terminology.
ct_map(x = terms, ct_spec = ct_spec)
# Note that if the controlled terminology mapping is restricted to a codelist
# code, e.g. C71113, then only `"/day"` and `"Every 2 hours"` get mapped to
# `"QD"` and `"Q2H"`, respectively; remaining terms won't match given the
# codelist code restriction, and will be mapped to an uppercase version of
# the original terms.
ct_map(x = terms, ct_spec = ct_spec, ct_clst = "C71113")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.