Derive Lab High toxicity Grade 0 - 4 and Low Toxicity Grades 0 - (-4)
Source:R/derive_var_atoxgr.R
derive_var_atoxgr.Rd
Derives character lab grade based on high and low severity/toxicity grade(s).
Usage
derive_var_atoxgr(
dataset,
lotox_description_var = ATOXDSCL,
hitox_description_var = ATOXDSCH
)
Arguments
- dataset
Input dataset
The variables specified by the
lotox_description_var
andhitox_description_var
arguments are expected to be in the dataset.ATOXGRL
, andATOXGRH
are expected as well.- lotox_description_var
Variable containing the toxicity grade description for low values, eg. "Anemia"
- hitox_description_var
Variable containing the toxicity grade description for high values, eg. "Hemoglobin Increased".
Details
Created variable ATOXGR
will contain values "-4", "-3", "-2", "-1" for low values
and "1", "2", "3", "4" for high values, and will contain "0" if value is gradable
and does not satisfy any of the criteria for high or low values. ATOXGR is set to
missing if information not available to give a grade.
Function applies the following rules:
High and low missing - overall missing
Low grade not missing and > 0 - overall holds low grade
High grade not missing and > 0 - overall holds high grade
(Only high direction OR low direction is NORMAL) and high grade normal - overall NORMAL
(Only low direction OR high direction is NORMAL) and low grade normal - overall NORMAL
otherwise set to missing
See also
BDS-Findings Functions that returns variable appended to dataset:
derive_basetype_records()
,
derive_var_analysis_ratio()
,
derive_var_anrind()
,
derive_var_atoxgr_dir()
,
derive_var_base()
,
derive_var_chg()
,
derive_var_ontrtfl()
,
derive_var_pchg()
,
derive_var_shift()
Examples
library(tibble)
adlb <- tribble(
~ATOXDSCL, ~ATOXDSCH, ~ATOXGRL, ~ATOXGRH,
"Hypoglycemia", "Hyperglycemia", NA_character_, "0",
"Hypoglycemia", "Hyperglycemia", "0", "1",
"Hypoglycemia", "Hyperglycemia", "0", "0",
NA_character_, "INR Increased", NA_character_, "0",
"Hypophosphatemia", NA_character_, "1", NA_character_
)
derive_var_atoxgr(adlb)
#> # A tibble: 5 × 5
#> ATOXDSCL ATOXDSCH ATOXGRL ATOXGRH ATOXGR
#> <chr> <chr> <chr> <chr> <chr>
#> 1 Hypoglycemia Hyperglycemia NA 0 NA
#> 2 Hypoglycemia Hyperglycemia 0 1 1
#> 3 Hypoglycemia Hyperglycemia 0 0 0
#> 4 NA INR Increased NA 0 0
#> 5 Hypophosphatemia NA 1 NA -1