value_choices {teal.transform} | R Documentation |
Value labeling and filtering based on variable relationship
Description
Wrapper on choices_labeled to label variable values basing on other variable values.
Usage
value_choices(data, var_choices, var_label = NULL, subset = NULL, sep = " - ")
## S3 method for class 'character'
value_choices(data, var_choices, var_label = NULL, subset = NULL, sep = " - ")
## S3 method for class 'data.frame'
value_choices(data, var_choices, var_label = NULL, subset = NULL, sep = " - ")
Arguments
data |
( |
var_choices |
( |
var_label |
( |
subset |
( See examples for more details. |
sep |
( |
Value
named character vector or delayed_data
object.
Examples
ADRS <- teal.transform::rADRS
value_choices(ADRS, "PARAMCD", "PARAM", subset = c("BESRSPI", "INVET"))
value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"))
value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"),
subset = c("BESRSPI - ARM A", "INVET - ARM A", "OVRINV - ARM A")
)
value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"), sep = " --- ")
# delayed version
value_choices("ADRS", c("PARAMCD", "ARMCD"), c("PARAM", "ARM"))
# functional subset
value_choices(ADRS, "PARAMCD", "PARAM", subset = function(data) {
levels(data$PARAMCD)[1:2]
})
[Package teal.transform version 0.5.0 Index]