library(tibble)
adbds <- tribble(
~PARAMCD, ~AVAL,
"AST", 42,
"AST", 52,
"AST", NA_real_,
"ALT", 33,
"ALT", 51
)
# Create a criterion flag with values "Y" and NA
derive_vars_crit_flag(
adbds,
condition = AVAL > 50,
description = "Absolute value > 50"
)
# Create criterion flag with values "Y", "N", and NA and parameter dependent
# criterion description
derive_vars_crit_flag(
adbds,
crit_nr = 2,
condition = AVAL > 50,
description = paste(PARAMCD, "> 50"),
values_yn = TRUE,
create_numeric_flag = TRUE
)
Run the code above in your browser using DataLab