View source: R/derive_vars_crit_flag.R
derive_vars_crit_flag | R Documentation |
CRITy
, CRITyFL
, and CRITyFN
The function derives ADaM compliant criterion flags, e.g., to facilitate subgroup analyses.
If a criterion flag can't be derived with this function, the derivation is not ADaM compliant. It helps to ensure that
the condition of the criterion depends only on variables of the same row,
the CRITyFL
is populated with valid values, i.e, either "Y"
and NA
or
"Y"
, "N"
, and NA
,
the CRITy
variable is populated correctly, i.e.,
set to a constant value within a parameter if CRITyFL
is populated with
"Y"
, "N"
, and NA
and
set to a constant value within a parameter if the criterion condition is
fulfilled and to NA
otherwise if CRITyFL
is populated with "Y"
, and
NA
derive_vars_crit_flag(
dataset,
crit_nr = 1,
condition,
description,
values_yn = FALSE,
create_numeric_flag = FALSE
)
dataset |
Input dataset
|
crit_nr |
The criterion number, i.e., the
|
condition |
Condition for flagging records See description of the
|
description |
The description of the criterion The An expression can be specified to set the value depending on the parameter. Please note that the value must be constant within a parameter.
|
values_yn |
Should If set to Otherwise, the
|
create_numeric_flag |
Create a numeric flag? If set to
|
The input dataset with the variables CRITy
, CRITyFL
, and
optionally CRITyFN
added.
BDS-Findings Functions that returns variable appended to dataset:
derive_basetype_records()
,
derive_var_analysis_ratio()
,
derive_var_anrind()
,
derive_var_atoxgr()
,
derive_var_atoxgr_dir()
,
derive_var_base()
,
derive_var_chg()
,
derive_var_ontrtfl()
,
derive_var_pchg()
,
derive_var_shift()
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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.