Helper Function for Deriving Analysis Datasets for LBT13 and LBT14
Source: R/h_adsl_adlb_merge_using_worst_flag.R
h_adsl_adlb_merge_using_worst_flag.RdHelper function that merges ADSL and ADLB datasets so that missing lab test records are inserted in the
output dataset.
Arguments
- adsl
(
data.frame)ADSLdataframe.- adlb
(
data.frame)ADLBdataframe.- worst_flag
(named
vector)
Worst post-baseline lab flag variable.- by_visit
(
logical)
defaults toFALSEto generate worst grade per patient. If worst grade per patient per visit is specified forworst_flag, thenby_visitshould beTRUEto generate worst grade patient per visit.- no_fillin_visits
(named
character)
Visits that are not considered for post-baseline worst toxicity grade. Defaults toc("SCREENING", "BASELINE").
Value
df containing variables shared between adlb and adsl along with variables PARAM, PARAMCD,
ATOXGR, and BTOXGR relevant for analysis. Optionally, AVISIT are AVISITN are included when
by_visit = TRUE and no_fillin_visits = c("SCREENING", "BASELINE").
Details
In the result data missing records will be created for the following situations:
Patients who are present in
adslbut have no lab data inadlb(both baseline and post-baseline).Patients who do not have any post-baseline lab values.
Patients without any post-baseline values flagged as the worst.
Examples
# `h_adsl_adlb_merge_using_worst_flag`
adlb_out <- h_adsl_adlb_merge_using_worst_flag(
tern_ex_adsl,
tern_ex_adlb,
worst_flag = c("WGRHIFL" = "Y")
)
# `h_adsl_adlb_merge_using_worst_flag` by visit example
adlb_out_by_visit <- h_adsl_adlb_merge_using_worst_flag(
tern_ex_adsl,
tern_ex_adlb,
worst_flag = c("WGRLOVFL" = "Y"),
by_visit = TRUE
)