process_set_values_to {admiraldev} | R Documentation |
set_values_to
ArgumentThe function creates the variables specified by the set_values_to
argument,
catches errors, provides user friendly error messages, and optionally checks
the type of the created variables.
process_set_values_to(dataset, set_values_to = NULL, expected_types = NULL)
dataset |
Input dataset |
set_values_to |
Variables to set A named list returned by |
expected_types |
If the argument is specified, the specified variables are checked whether
the specified type matches the type of the variables created by
Permitted Values: A character vector with values |
The input dataset with the variables specified by set_values_to
added/updated
library(dplyr)
data <- tribble(
~AVAL,
20
)
try(
process_set_values_to(
data,
set_values_to = exprs(
PARAMCD = BMI
)
)
)
try(
process_set_values_to(
data,
set_values_to = exprs(
PARAMCD = 42
),
expected_types = c(PARAMCD = "character")
)
)