View source: R/abnormal_by_worst_grade.R
h_adlb_abnormal_by_worst_grade | R Documentation |
count_abnormal_by_worst_grade()
Helper function to prepare an ADLB data frame to be used as input in
count_abnormal_by_worst_grade()
. The following pre-processing steps are applied:
adlb
is filtered on variable avisit
to only include post-baseline visits.
adlb
is filtered on variables worst_flag_low
and worst_flag_high
so that only
worst grades (in either direction) are included.
From the standard lab grade variable atoxgr
, the following two variables are derived
and added to adlb
:
A grade direction variable (e.g. GRADE_DIR
). The variable takes value "HIGH"
when
atoxgr > 0
, "LOW"
when atoxgr < 0
, and "ZERO"
otherwise.
A toxicity grade variable (e.g. GRADE_ANL
) where all negative values from atoxgr
are
replaced by their absolute values.
Unused factor levels are dropped from adlb
via droplevels()
.
h_adlb_abnormal_by_worst_grade(
adlb,
atoxgr = "ATOXGR",
avisit = "AVISIT",
worst_flag_low = "WGRLOFL",
worst_flag_high = "WGRHIFL"
)
adlb |
( |
atoxgr |
( |
avisit |
( |
worst_flag_low |
( |
worst_flag_high |
( |
h_adlb_abnormal_by_worst_grade()
returns the adlb
data frame with two new
variables: GRADE_DIR
and GRADE_ANL
.
abnormal_by_worst_grade
h_adlb_abnormal_by_worst_grade(tern_ex_adlb) %>%
dplyr::select(ATOXGR, GRADE_DIR, GRADE_ANL) %>%
head(10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.