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 = atoxgr_criteria_ctcv4,
  criteria_direction,
  get_unit_expr
)

Arguments

dataset

Input data set

The columns specified by tox_description_var parameter is expected.

new_var

Name of the character grade variable to create, for example, ATOXGRH or ATOXGRL.

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)

Default: atoxgr_criteria_ctcv4

admiral metadata data set atoxgr_criteria_ctcv4 implements Common Terminology Criteria for Adverse Events (CTCAE) v4.0

The metadata should have the following variables:

  • TERM: variable to hold the term describing the criteria applied to a particular lab test, eg. "Anemia" or "INR Increased". Note: the variable is case insensitive.

  • DIRECTION: variable to hold the direction of the abnormality of a particular lab test value. "L" is for LOW values, "H" is for HIGH values. Note: the variable is case insensitive.

  • SI_UNIT_CHECK: variable to hold unit of particular lab test. Used to check against input data if criteria is based on absolute values.

  • VAR_CHECK: variable to hold comma separated list of variables used in criteria. Used to check against input data that variables exist.

  • GRADE_CRITERIA_CODE: variable to hold code that creates grade based on defined criteria.

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 SI_UNIT_CHECK in metadata (see meta_criteria parameter).

Permitted Values: A variable containing unit from the input dataset, or a function call, for example, get_unit_expr = extract_unit(PARAM).

Details

new_var is derived with values NA, "0", "1", "2", "3", "4", where "4" is the most severe grade

Value

The input dataset with the character variable added

Author(s)

Gordon Miller

See Also

BDS-Findings Functions that returns variable appended to dataset: derive_var_analysis_ratio(), derive_var_anrind(), derive_var_atoxgr(), derive_var_basetype(), derive_var_base(), derive_var_chg(), derive_var_ontrtfl(), derive_var_pchg(), derive_var_shift()

Examples

library(dplyr, warn.conflicts = FALSE)

data <- tibble::tribble(
  ~ATOXDSCL,                     ~AVAL,  ~ANRLO,   ~ANRHI, ~PARAM,
  "Hypoglycemia",                119,    4,        7,      "Glucose (mmol/L)",
  "Hypoglycemia",                120,    4,        7,      "Glucose (mmol/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_ctcv4,
  criteria_direction = "L",
  get_unit_expr = extract_unit(PARAM)
)

data <- tibble::tribble(
  ~ATOXDSCH,                     ~AVAL,  ~ANRLO,   ~ANRHI, ~PARAM,
  "Hyperglycemia",               119,    4,        7,      "Glucose (mmol/L)",
  "Hyperglycemia",               120,    4,        7,      "Glucose  (mmol/L)",
  "GGT increased",               129,    0,        30,     "Gamma Glutamyl Transferase (U/L)",
  "Lymphocyte count increased",  4,      1,        4,      "Lymphocytes Abs (10^9/L)",
  "Lymphocyte count increased",  2,      1,        4,      "Lymphocytes Abs (10^9/L)",
  "GGT increased",               140,    120,      180,    "Gamma Glutamyl Transferase (U/L)"
)

derive_var_atoxgr_dir(data,
  new_var = ATOXGRH,
  tox_description_var = ATOXDSCH,
  meta_criteria = atoxgr_criteria_ctcv4,
  criteria_direction = "H",
  get_unit_expr = extract_unit(PARAM)
)

[Package admiral version 0.8.4 Index]