derive_var_atoxgr_dir {admiral} | R Documentation |
Derive Lab Toxicity Grade 0 - 4
Description
Derives a character lab grade based on severity/toxicity criteria.
Usage
derive_var_atoxgr_dir(
dataset,
new_var,
tox_description_var,
meta_criteria,
criteria_direction,
get_unit_expr,
signif_dig = get_admiral_option("signif_digits")
)
Arguments
dataset |
Input dataset The variables specified by the |
new_var |
Name of the character grade variable to create, for example, |
tox_description_var |
Variable containing the description of the grading criteria. For example: "Anemia" or "INR Increased". |
meta_criteria |
Metadata data set holding the criteria (normally a case statement) Permitted Values:
|
criteria_direction |
Direction (L= Low, H = High) of toxicity grade. Permitted Values: "L", "H" |
get_unit_expr |
An expression providing the unit of the parameter The result is used to check the units of the input parameters. Compared with
Permitted Values: A variable containing unit from the input dataset, or a function call,
for example, |
signif_dig |
Number of significant digits to use when comparing a lab value against another value. Significant digits used to avoid floating point discrepancies when comparing numeric values. See blog: How admiral handles floating points |
Details
new_var
is derived with values NA, "0", "1", "2", "3", "4", where "4" is the most
severe grade
"4" is where the lab value satisfies the criteria for grade 4.
"3" is where the lab value satisfies the criteria for grade 3.
"2" is where the lab value satisfies the criteria for grade 2.
"1" is where the lab value satisfies the criteria for grade 1.
"0" is where a grade can be derived and is not grade "1", "2", "3" or "4".
NA is where a grade cannot be derived.
Value
The input dataset with the character variable added
See Also
BDS-Findings Functions that returns variable appended to dataset:
derive_basetype_records()
,
derive_var_analysis_ratio()
,
derive_var_anrind()
,
derive_var_atoxgr()
,
derive_var_base()
,
derive_var_chg()
,
derive_var_ontrtfl()
,
derive_var_pchg()
,
derive_var_shift()
Examples
library(tibble)
data <- tribble(
~ATOXDSCL, ~AVAL, ~ANRLO, ~ANRHI, ~PARAM,
"Hypoglycemia", 119, 4, 7, "Glucose (mmol/L)",
"Lymphocyte count decreased", 0.7, 1, 4, "Lymphocytes Abs (10^9/L)",
"Anemia", 129, 120, 180, "Hemoglobin (g/L)",
"White blood cell decreased", 10, 5, 20, "White blood cell (10^9/L)",
"White blood cell decreased", 15, 5, 20, "White blood cell (10^9/L)",
"Anemia", 140, 120, 180, "Hemoglobin (g/L)"
)
derive_var_atoxgr_dir(data,
new_var = ATOXGRL,
tox_description_var = ATOXDSCL,
meta_criteria = atoxgr_criteria_ctcv5,
criteria_direction = "L",
get_unit_expr = extract_unit(PARAM)
)
data <- tribble(
~ATOXDSCH, ~AVAL, ~ANRLO, ~ANRHI, ~PARAM,
"CPK increased", 129, 0, 30, "Creatine Kinase (U/L)",
"Lymphocyte count increased", 4, 1, 4, "Lymphocytes Abs (10^9/L)",
"Lymphocyte count increased", 2, 1, 4, "Lymphocytes Abs (10^9/L)",
"CPK increased", 140, 120, 180, "Creatine Kinase (U/L)"
)
derive_var_atoxgr_dir(data,
new_var = ATOXGRH,
tox_description_var = ATOXDSCH,
meta_criteria = atoxgr_criteria_ctcv5,
criteria_direction = "H",
get_unit_expr = extract_unit(PARAM)
)