get_levels | R Documentation |
Extracts the factor levels of a vector or returns the unique values if the vector is not a factor.
get_levels(x)
x |
a vector |
x vector
A character vector containing the levels of the factor/vector
data(adae, package = "tidyCDISC")
# Create levels based on VARN
varN_fctr_adae <- varN_fctr_reorder(adae)
# `adae` does not have factor but `varN_fctr_adae` does
levels(adae$RACE)
levels(varN_fctr_adae$RACE)
# `get_levels()` either creates the factor or retrieves it
get_levels(adae$RACE)
get_levels(varN_fctr_adae$RACE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.