knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(dplyr) library(dunlin) library(chevron)
chevron
is a collection of functions to creates tables, listings, and graphs following Roche standards for clinical trials reporting. After loading the R packages and the trial data, the output is to be created by the main function run(...)
. Two arguments object=
and adam_db=
are always expected in the function. object=
specifies which Roche Standard Template ID to use. adam_db=
specifies the input dataset. Other mandatory and optional arguments within the run
function vary depending on which template ID is called. To access which arguments are required and what functions are used in each template, simply try ?template
(e.g. ?aet01
) to see more detailed descriptions and instructions.
The input dataset expected by the argument adam_db=
in the run(...)
function is a collection of ADaM
datasets as a list object. Each ADaM
dataset is expected to be an object of data frame. If the ADaM
datasets are read in individually, user will need to combine them into a list object and provide the name of the list to adam_db=
. Also, each element in the list are expected to have corresponding ADaM
dataset names. Conventional ADaM
dataset names, including adsl
,adex
, adae
, adlb
,advs
,adeg
,adcm
,admh
,adrs
, and adtte
, can be picked up by chevron
with one exception.
std_data <- list(adsl = adsl, adae = adae) run(object = aet01_nollt, adam_db = std_data)
By default, chevron
does not pull any subject-level information from either adsl
or adsub
and merge into the analysis dataset in the underlying preprocessing steps. The analysis dataset fed into adam_db=
is expected to have all variables required for analysis available.
In the output generation, we often need to specify a particular sorting order of a variable at the time of display. In chevron
, a character variable needs to be factorized with pre-specified levels to display in order. When encountering cases, for instance, "ARM A"
has an Asian group only while "ARM B"
has both Asian and White groups, it is not able to produce outputs like the demographic table unless "RACE"
is factorized to provide access to the same level attribute of the variable "RACE"
after the arm split. It is noted that the feature comes from rtables
instead of chevron
.
proc_data <- syn_data proc_data$adsl <- proc_data$adsl %>% mutate(RACE = case_when( ARMCD == "ARM A" ~ "ASIAN", ARMCD == "ARM B" & !.data$RACE %in% c("WHITE", "ASIAN") ~ "ASIAN", TRUE ~ RACE ))
Having "RACE"
as a character variable rather than a factor leads to error message showing up as "Error: Error applying analysis function (var - RACE): Number of rows generated by analysis function do not match across all columns," and it is recommended to convert analysis variable "RACE"
to a factor.
run(dmt01, proc_data)
To resolve this issue, simply try factorizing the variable "RACE"
:
proc_data$adsl$RACE <- as.factor(proc_data$adsl$RACE) run(dmt01, proc_data)
The run
function when calling a Graphics Template ID returns a gTree
object which will be used in the downstream workflow for output generation. There are two alternative approaches to rendering the plot: (1) having draw = TRUE
in the run
function to enable the generated plot to be automatically created and viewed via the Plots
tab, and (2) calling the function grid.draw
from the package grid
which can be utilized to render the plot for viewing and testing purpose. See example below:
proc_data <- log_filter(syn_data, PARAMCD == "OS", "adtte") # method 1 run(kmg01, proc_data, dataset = "adtte", draw = TRUE) # method 2 res <- run(kmg01, proc_data, dataset = "adtte") grid::grid.newpage() grid::grid.draw(res)
lbl_overall
: Column of TotalThe generic argument lbl_overall
controls whether the column of total will be produced or not. lbl_overall = NULL
suppresses the total, lbl_overall = "All Patients"
produces the total.
Column counts are displayed by default. There is no generic argument controlling whether the count of unique number of subjects (N=xxx) will be displayed in the column header or not. Users are allowed to customize the display of N=xxx by forcing display_columncounts = FALSE
to wipe column counts away during the postprocessing (with precautions and it is not recommended).
tbl <- run(dmt01, syn_data) # table with column counts tbl@col_info@display_columncounts <- FALSE tbl # no column counts now
AET01
)The aet01
template produces the standard safety summary.
run(aet01, syn_data, arm_var = "ARM")
Analyses under "Total number of patients with at least one" can be removed, added, or modified by editing the parameter anl_vars
. An analysis here is an abbreviated name of the analysis of interest, and supported by a variable in ADAE
derived under the condition of interest. The defined analyses currently include "FATAL"
, "SER"
, "SERWD"
, "SERDSM"
, "RELSER"
, "WD"
, "DSM"
, "REL"
, "RELWD"
, "RELDSM"
, and "SEV"
. When modification is made, analyses must all be listed in the argument anl_vars
. The example below shows adding the customized analysis "RELCTC35"
.
proc_data <- syn_data proc_data$adae <- proc_data$adae %>% filter(.data$ANL01FL == "Y") %>% mutate( FATAL = with_label(.data$AESDTH == "Y", "AE with fatal outcome"), SER = with_label(.data$AESER == "Y", "Serious AE"), SEV = with_label(.data$ASEV == "SEVERE", "Severe AE (at greatest intensity)"), REL = with_label(.data$AREL == "Y", "Related AE"), WD = with_label(.data$AEACN == "DRUG WITHDRAWN", "AE leading to withdrawal from treatment"), DSM = with_label( .data$AEACN %in% c("DRUG INTERRUPTED", "DOSE INCREASED", "DOSE REDUCED"), "AE leading to dose modification/interruption" ), SERWD = with_label(.data$SER & .data$WD, "Serious AE leading to withdrawal from treatment"), SERDSM = with_label(.data$SER & .data$DSM, "Serious AE leading to dose modification/interruption"), RELSER = with_label(.data$SER & .data$REL, "Related Serious AE"), RELWD = with_label(.data$REL & .data$WD, "Related AE leading to withdrawal from treatment"), RELDSM = with_label(.data$REL & .data$DSM, "Related AE leading to dose modification/interruption"), CTC35 = with_label(.data$ATOXGR %in% c("3", "4", "5"), "Grade 3-5 AE"), CTC45 = with_label(.data$ATOXGR %in% c("4", "5"), "Grade 4/5 AE"), RELCTC35 = with_label(.data$ATOXGR %in% c("3", "4", "5") & .data$AEREL == "Y", "Related Grade 3-5") ) proc_data$adsl <- proc_data$adsl %>% mutate(DCSREAS = reformat(.data$DCSREAS, missing_rule)) run(aet01, proc_data, anl_vars = list(safety_var = c("FATAL", "SER", "RELSER", "RELCTC35")), auto_pre = FALSE)
AET01_AESI
)The aet01_aesi
template produces the standard safety summary for adverse events of special interest.
run(aet01_aesi, syn_data)
Additional analyses can be added with the argument aesi_vars
, please type ?aet01_aesi
in console to find out the list of all pre-defined optional analyses in the HELP.
run(aet01_aesi, syn_data, aesi_vars = c("RESLWD", "RELSER"))
For studies with more than one study drug, users need to define the analyses in adae
and add to the argument aesi_vars
following the example above. No pre-defined analysis is available at this moment.
AET02
)1) The template aet02
produces the standard adverse event summary by MedDRA system organ class and preferred term.
2) The template does not include the column of total as default. The 'All Patients' column can be added with the argument lbl_overall = "All Patients"
.
3) Missing values in "AEBODSYS"
, and "AEDECOD"
are labeled as No Coding Available
.
run(aet02, syn_data)
The syntax below displays adverse events by MedDRA system organ class, high-level term and preferred term.
run(aet02, syn_data, row_split_var = c("AEBODSYS", "AEHLT"))
The syntax below displays adverse events by preferred term only.
run(aet02, syn_data, row_split_var = NULL)
AET03
)This aet03
template produces the standard adverse event by greatest intensity summary
run(aet03, syn_data)
NCI CTCAE
Grade (AET04
)NCI CTCAE
Grade1) The aet04
template produces the standard adverse event by highest NCI CTCAE
grade summary.
2) By default, this template includes the grouped grades of 'Grade 1-2' and 'Grade 3-4'.
3) By default this template removes the rows with 0 count.
4) If a treatment group does not have any adverse event, the treatment group is automatically displayed providing that it is defined in ADSL
.
run(aet04, syn_data)
NCI CTCAE
Grade (Fill in of Grades)If, for some preferred terms, not all grades occur but all grades should be displayed, this can be achieved by specifying the argument prune_0 = FALSE
.
run(aet04, syn_data, prune_0 = FALSE)
NCI CTCAE
Grade with modified grouping of gradeCollapsing grade 3-4 with grade 5, can be achieved by modifying the definition of grade groups in the argument grade_groups
.
grade_groups <- list( "Grade 1-2" = c("1", "2"), "Grade 3-5" = c("3", "4", "5") ) run(aet04, syn_data, grade_groups = grade_groups, prune_0 = FALSE)
AET05
)1) The aet05
template produces the standard adverse event rate adjusted for patient-years at risk summary considering first occurrence only.
2) By default, all adsaftte
parameter codes containing the string "TTE"
are included in the output. Users are expected to filter the parameter(s) of interest from input safety time-to-event dataset in pre-processing if needed.
3) In the input safety time-to-event dataset, in the censoring variable CNSR
, 0
indicates the occurrence of an event of interest and 1
denotes censoring.
proc_data <- log_filter(syn_data, PARAMCD == "AETTE1", "adsaftte") run(aet05, proc_data)
1) The type of the confidence interval for rate can be specified by the argument conf_type
. Options include normal
(default), normal_log
and exact
.
2) The confidence interval can be adjusted by the argument conf_level
.
run(aet05, syn_data, conf_level = 0.90, conf_type = "exact")
AET05_ALL
)1) The aet05_all
template produces the standard adverse event rate adjusted for patient-years at risk summary considering all occurrences.
2) By default, all adsaftte
parameter codes containing the string "TOT"
and the parameter code "AEREPTTE"
are required. "TOT"
parameters store the number of occurrences of adverse event of interests. Parameter code "AEREPTTE"
stores the time to end of adverse event reporting period in years that contribute to the summary of "total patient-years at risk" in the output. Users are expected to filter parameters of interest from input analysis dataset in pre-processing, if needed.
3) In the input safety time-to-event dataset, in the censoring variable CNSR
, 0
indicates the occurrence of an event of interest and 1
denotes censoring.
proc_data <- log_filter(syn_data, PARAMCD == "AETOT1" | PARAMCD == "AEREPTTE", "adsaftte") run(aet05_all, proc_data)
1) The type of the confidence interval for rate can be specified by the argument conf_type
. Options include normal
(default), normal_log
, exact
, and byar
.
2) The confidence interval can be adjusted by the argument conf_level
.
run(aet05_all, syn_data, conf_level = 0.90, conf_type = "exact")
AET10
)1) The aet10
template produces the standard most common adverse events occurring with relative frequency >=5% output.
run(aet10, syn_data)
To modify the threshold for displaying preferred terms, this can be achieved by providing the threshold to the argument atleast
.
run(aet10, syn_data, atleast = 0.08)
CFBT01
)1) By default, the cfbt01
template displays analysis value (AVAL
) and absolute change from baseline (CHG
) for each visit.
2) The template does not include the column of total by default.
3) Each parameter is presented on a separate page.
4) The absolute change from baseline at baseline value is not displayed.
proc_data <- log_filter( syn_data, PARAMCD %in% c("DIABP", "SYSBP"), "advs" ) run(cfbt01, proc_data, dataset = "advs")
The skip
arguments controls which visit values should not be displayed. For instance, to mask the changes from baseline during the "SCREENING" and "BASELINE" visits.
run(cfbt01, proc_data, dataset = "advs", skip = list(CHG = c("SCREENING", "BASELINE")))
To display only the absolute value, specify summaryvars = "AVAL"
.
run(cfbt01, proc_data, dataset = "advs", summaryvars = "AVAL")
CMT01A
)1) The cmt01a
template displays concomitant medications by ATC Level 2
and Preferred Name by default.
2) The template does not include the column of total by default.
3) The template sort medication class and preferred name by alphabetical order by default.
run(cmt01a, syn_data)
ATC class level
)run(cmt01a, syn_data, row_split_var = "ATC1")
The argument sort_by_freq = TRUE
sort medication class by frequency.
run(cmt01a, syn_data, sort_by_freq = TRUE)
The cmt01a
template includes the analysis of 'total number of treatments' by default, modify the argument summary_labels
to change it.
run(cmt01a, syn_data, summary_labels = list(TOTAL = cmt01_label, ATC2 = cmt01_label[1]))
CMT02_PT
)1) The cmt02_pt
template displays concomitant medications by Preferred Name by default.
2) The template does not include the column of total by default.
3) The template sorts preferred name by alphabetical order by default. Set the argument sort_by_freq = TRUE
to sort preferred names by frequency.
run(cmt02_pt, syn_data)
COXT01
)1) The coxt01
template produces the standard Cox regression output.
2) Users are expected to pre-process the input analysis data by selecting a time-to-event parameter to be analyzed. The example below is based on the time-to-event parameter "Duration of Confirmed Response by Investigator".
3) The time variable in the model is specified through the time_var
argument. By default, time_var
is set to "AVAL"
, which comes from ADTTE.AVAL
.
4) The event variable in the model is specified through the event_var
argument. By default, event_var
is set to "EVENT"
, which is derived based on the censoring indicator ADTTE.CNSR
in the pre-processing function coxt01_pre
.
5) If there are more than two treatment groups present in the input analysis data, users are also expected to select only two treatment groups. The example below is based on treatment groups "Arm A"
and "Arm B"
.
proc_data <- log_filter(syn_data, PARAMCD == "OS", "adtte") proc_data <- log_filter(proc_data, ARMCD != "ARM C", "adsl") run(coxt01, proc_data, time_var = "AVAL", event_var = "EVENT")
To add the interaction term to the model, interaction = TRUE
, which is passed to tern::control_coxreg()
, needs to be specified.
run(coxt01, proc_data, covariates = "AAGE", interaction = TRUE)
1) By default, "SEX"
, "RACE"
and "AAGE"
are used as the covariates for the model.
2) Users can specify a different set of covariates through the covariates
argument. In the example below, "RACE"
and "AAGE"
are used as covariates.
run(coxt01, proc_data, covariates = c("RACE", "AAGE"))
1) By default, strata = NULL
(no stratification), ties = "exact"
(equivalent to DISCRETE
in SAS), and conf_level = 0.95
are applied.
2) Users can specify one or more stratification variables via the strata
argument.
3) Other tie handling methods, i.e., "efron"
or "breslow"
, can be specified in the tie
argument, which is passed to tern::control_coxreg()
.
4) Users can also customize the alpha level for the confidence intervals through the conf_level
argument, which is passed to tern::control_coxreg()
.
run(coxt01, proc_data, covariates = c("SEX", "AAGE"), strata = c("RACE"), conf_level = 0.90)
COXT02
)1) The coxt02
template produces the standard multi-variable cox regression output.
2) Users are expected to pre-process the input analysis data by selecting a time-to-event parameter to be analyzed. The example below is based on the time-to-event parameter "Duration of Confirmed Response by Investigator".
3) The time variable in the model is specified through the time_var
argument. By default, time_var
is set to "AVAL"
, which comes from ADTTE.AVAL
.
4) The event variable in the model is specified through the event_var
argument. By default, event_var
is set to "EVENT"
, which is derived based on the censoring indicator ADTTE.CNSR
in the pre-processing function coxt01_pre
.
proc_data <- log_filter(syn_data, PARAMCD == "OS", "adtte") run(coxt02, proc_data, time_var = "AVAL", event_var = "EVENT")
1) By default, "SEX"
, "RACE"
and "AAGE"
are used as the covariates for the model.
2) Users can specify a different set of covariates through the covariates
argument. In the example below, "RACE"
and "AAGE"
are used as covariates.
run(coxt02, proc_data, covariates = c("RACE", "AAGE"))
1) By default, strata = NULL
(no stratification), ties = "exact"
(equivalent to DISCRETE
in SAS), and conf_level = 0.95
are applied.
2) Users can specify one or more stratification variables via the strata
argument.
3) Other tie handling methods, i.e., "efron"
or "breslow"
, can be specified in the tie
argument, which is passed to tern::control_coxreg()
.
4) Users can also customize the alpha level for the confidence intervals through the conf_level
argument, which is passed to tern::control_coxreg()
.
run(coxt02, proc_data, covariates = c("SEX", "AAGE"), strata = c("RACE"), conf_level = 0.90, ties = "efron")
DMT01
)1) The dmt01
template produces the standard demographics and baseline characteristics summary.
2) This template includes the column of total by default.
run(dmt01, syn_data)
To remove the column of total, set the argument lbl_overall
to NULL
.
run(dmt01, syn_data, lbl_overall = NULL)
1) Study specific continuous variables can be added to the standard demographics and baseline characteristics summary by editing the argument summaryvars
. To add or remove analyses, you need to pass all variables you would like to include to the argument.
2) CHEVRON performs the analysis based on the type of variable as defined in the input data.
run(dmt01, syn_data, summaryvars = c("AGE", "AGEGR1", "SEX", "ETHNIC", "RACE", "BBMISI"), lbl_overall = NULL)
1) Study specific categorical variables can be added to the standard demographics and baseline characteristics summary by editing the argument summaryvars
.
2) To display the values within a categorical variable in pre-specified order, the categorical variable need to be factorized with pre-specified order provided as levels.
proc_data <- syn_data proc_data$adsl <- proc_data$adsl %>% mutate( SEX = reformat(.data$SEX, rule(Male = "M", Female = "F")), BBMIGR1 = factor(case_when( BBMISI < 15 ~ "Very severely underweight", BBMISI >= 15 & BBMISI < 16 ~ "Severely underweight", BBMISI >= 16 & BBMISI < 18.5 ~ "Underweight", BBMISI >= 18.5 & BBMISI < 25 ~ "Normal (healthy weight)", BBMISI >= 25 & BBMISI < 30 ~ "Overweight", BBMISI >= 30 & BBMISI < 35 ~ "Obese Class I (Moderately obese)", BBMISI >= 35 & BBMISI < 40 ~ "Obese Class II (Severely obese)", BBMISI >= 40 ~ "Obese Class III (Very severely obese)" ), levels = c( "Very severely underweight", "Severely underweight", "Underweight", "Normal (healthy weight)", "Overweight", "Obese Class I (Moderately obese)", "Obese Class II (Severely obese)", "Obese Class III (Very severely obese)" )) ) run(dmt01, proc_data, summaryvars = c("AGE", "AGEGR1", "SEX", "ETHNIC", "RACE", "BBMIGR1"), auto_pre = FALSE)
ADVS
or ADSUB
To add baseline vital signs or other baseline characteristics to the demographics and baseline characteristics summary, manual preprocess of input adsl
dataset is expected and merge the vital signs baseline values from advs
(where ADVS.ABLFL == "Y"
) or adsub
with adsl
by unique subject identifier.
proc_data <- syn_data diabpbl <- proc_data$advs %>% filter(ABLFL == "Y" & PARAMCD == "DIABP") %>% mutate(DIABPBL = AVAL) %>% select("STUDYID", "USUBJID", "DIABPBL") proc_data$adsl <- proc_data$adsl %>% mutate(SEX = reformat(.data$SEX, rule(Male = "M", Female = "F"))) %>% left_join(diabpbl, by = c("STUDYID", "USUBJID")) run(dmt01, proc_data, summaryvars = c("AGE", "AGEGR1", "SEX", "ETHNIC", "RACE", "DIABPBL"), auto_pre = FALSE)
DST01
)1) The dst01
template produces the standard patient disposition summary.
2) The template includes the column of total by default. Use lbl_overall = NULL
to suppress the default.
run(dst01, syn_data, lbl_overall = NULL)
1) The syntax below produces the standard patient disposition summary with grouping of the discontinuation reasons.
2) The variable [ADSL.DCSREASGP
] that groups the discontinuation reasons needs to be derived manually and provided in the input adsl
dataset.
run(dst01, syn_data, detail_vars = list(Discontinued = c("DCSREASGP", "DCSREAS")), lbl_overall = NULL)
The syntax below adds the end of treatment status to the standard patient disposition summary by providing the end of treatment status variable to the argument trt_status_var
.
run(dst01, syn_data, trt_status_var = "EOTSTT", lbl_overall = NULL)
The syntax adds the details of study ongoing/alive status to the standard patient disposition summary by modifying the argument detail_vars
.
run(dst01, syn_data, detail_vars = list(Discontinued = "DCSREAS", Ongoing = "STDONS"))
DTHT01
)The dtht01
template produces the standard deaths output.
run(dst01, syn_data)
run(dtht01, syn_data, other_category = TRUE)
NOTE: In order to avoid the warning above and display 'Other' as the last category under "Primary Cause of Death" right above the detailed reasons for "Other", the user is expected to manually provide levels to ADSL.DTHCAT
based on categories available in the dataset.
Setting time_since_last_dose
to TRUE
, the syntax produces the count of deaths by days from last study drug administration as well as the count of deaths by primary cause and days from last study drug administration.
run(dtht01, syn_data, time_since_last_dose = TRUE)
EGT01
)The egt01
template produces the standard ECG results and change from baseline by visit summary.
run(egt01, syn_data)
EGT02_1
)The egt02_1
template produces the standard ECG abnormalities summary where the abnormalities are summarized regardless of the abnormality at baseline.
run(egt02_1, syn_data)
EGT02_2
)The egt02_2
template produces the standard ECG abnormalities summary where the abnormalities are summarized among subject without abnormality at baseline.
run(egt02_2, syn_data)
EGT03
)The egt03
template produces the standard shift table of ECG interval data - baseline versus minimum post-baseline summary.
proc_data <- log_filter(syn_data, PARAMCD == "HR", "adeg") run(egt03, proc_data)
To produce the standard shift table of ECG interval data - baseline versus maximum post-baseline summary....TBA
EGT05_QTCAT
)The egt05_qtcat
template produces the standard ECG actual values and changes from baseline by visit summary.
run(egt05_qtcat, syn_data)
The template have two default analyses of ADEG.AVALCAT1
and ADEG.CHGCAT1
. To keep only the analyses needed, this can be achieved by modifying the parameter summaryvars
.
run(egt05_qtcat, syn_data, summaryvars = c("AVALCAT1"))
EXT01
)1) The ext01
template displays total number of doses administered and total dose administered by default
2) The template does not include the column of total by default
run(ext01, syn_data)
LBT01
)1) The lbt01
template produces the standard laboratory test results and change from baseline by visit.
2) To select the SI/CV/LS results and the panel (chemistry/hematology/urinalysis/coagulation etc.) to display, user defines individual filters and apply to input datasets prior to running CHEVRON.
t_lb_chg <- run(lbt01, syn_data) head(t_lb_chg, 20)
TBA
LBT04
)1) The lbt04
template produces the standard laboratory abnormalities summary.
2) The template subsets to SI results by default.
3) The laboratory tests and directions of abnormality in this template is data-driven. Table entries provide the number of patients with a during treatment laboratory value abnormality in the direction specified among patients without this abnormality at baseline.
run(lbt04, syn_data)
LBT05
)1) The lbt05
template produces the standard laboratory abnormalities summary for marked abnormalities.
2) The laboratory tests and directions of abnormality in this template is currently data-driven. The standard metadata for Safety Lab Standardization will be incorporated in future release.
run(lbt05, syn_data)
MLAs
LBT06
)1) The lbt06
template produces the standard laboratory abnormalities by visit and baseline status summary.
run(lbt06, syn_data)
NCI CTCAE
Grade Post-Baseline (LBT07
)NCI CTCAE
Grade Post-Baseline1) The lbt07
template produces the standard laboratory test results with highest NCI CTCAE
grade post-baseline summary.
2) The laboratory tests and grades in this template is currently data-driven. The standard metadata for possible lab tests and corresponding NCI CTCAE
grade will be incorporated in future release.
run(lbt07, syn_data)
NCI-CTCAE
Grade Post-Baseline by Baseline NCI-CTCAE
Grade (LBT14
)NCI-CTCAE
Grade Post-Baseline by Baseline NCI-CTCAE
Grade (High)To produce the standard laboratory test results shift table - highest NCI-CTCAE
grade post-baseline by baseline NCI-CTCAE
grade summary for high abnormalities, use the lbt14
template and set the parameter direction
to high
.
run(lbt14, syn_data, direction = "high")
NCI-CTCAE
Grade Post-Baseline by Baseline NCI-CTCAE
Grade (Low)To produce the standard laboratory test results shift table - highest NCI-CTCAE
grade post-baseline by baseline NCI-CTCAE
grade summary for high abnormalities, use the lbt14
template and the argument direction
is low
by default.
run(lbt14, syn_data)
NCI-CTCAE
Grade Post-Baseline by Baseline NCI-CTCAE
Grade (High) Without Patients with Missing BaselineTo exclude patients with missing baseline grade, set the argument gr_missing
to excl
.
run(lbt14, syn_data, direction = "high", gr_missing = "excl")
NCI-CTCAE
Grade Post-Baseline by Baseline NCI-CTCAE
Grade (Low) with Missing Baseline Considered as Grade 0To count patients with missing baseline grade as grade 0, set the argument gr_missing
to gr_0
.
run(lbt14, syn_data, gr_missing = "gr_0")
NCI-CTCAE
Grade Post-Baseline by Baseline NCI-CTCAE
Grade (with fill in of grades)To display all possible grades even if they do not occur in the data, set the argument prune_0
to FALSE
.
run(lbt14, syn_data, direction = "high", prune_0 = FALSE)
MHT01
)1) The mht01
template displays medical conditions by MedDRA system organ class and Preferred Name by default.
2) The default treatment variable is "ADSL.ARM"
.
3) The user is expected to use filter to subset medical conditions prior to or on entering study.
4) By default, the template produces the overall 'total number of conditions' as well as the 'total number of conditions' per body system after the summary of patients.
5)This template currently does not support sorting MedDRA system organ class and preferred names by order of frequency.
run(mht01, syn_data)
run(mht01, syn_data, lbl_overall = "All Patients")
PDT01
)1) The pdt01
template produces the standard major protocol deviations output.
2) Users are expected to filter addv
to only include records where DVCAT == "MAJOR"
in pre-processing.
proc_data <- syn_data proc_data$addv <- proc_data$addv %>% filter(DVCAT == "MAJOR") run(pdt01, proc_data)
PDT02
)1) The pdt02
template produces the reasons for major protocol deviations related to epidemic/pandemic summary.
2) By default, ADDV.DVREAS
provides the reason and ADDV.DVTERM
provides the description.
3) By default, addv
has been filtered to include only records that meet the condition AEPRELFL == "Y" & DVCAT == "MAJOR"
.
run(pdt02, syn_data)
RMPT01
)The rmpt01
template produces the standard duration of exposure output for the Risk Management Plan (RMP
).
Person time is the sum of exposure across all patients in days.
run(rmpt01, syn_data)
RMPT03
)The rmpt03
template produces the standard extent of exposure by age group and gender output for the Risk Management Plan (RMP
).
By default, the AGEGR1
variable is used as the age group. If AGEGR1
is available in ADSL
only but not in ADEX
, it needs to be added to ADEX
first.
proc_data <- syn_data proc_data <- propagate(proc_data, "adsl", "AGEGR1", "USUBJID") run(rmpt03, proc_data)
Any other study specific age group can be used by editing the parameter summaryvars
. For all RMP
tables, if the variable specified per summaryvars
is unavailable in ADEX
, it needs to be added to ADEX
first.
proc_data <- syn_data proc_data$adsl <- proc_data$adsl %>% mutate( AGEGR2 = with_label( factor(case_when( AAGE < 18 ~ "<18", AAGE >= 18 & AAGE <= 65 ~ "18 - 65", AAGE > 65 ~ ">65", ), levels = c("<18", "18 - 65", ">65")), "Age Group 2" ) ) proc_data <- propagate(proc_data, "adsl", "AGEGR2", "USUBJID") run(rmpt03, proc_data, summaryvars = "AGEGR2")
RMPT04
)The rmpt04
template produces the standard extent of exposure by ethnic origin output for the Risk Management Plan (RMP
).
run(rmpt04, syn_data)
RMPT05
)The rmpt05
template produces the standard extent of exposure by race output for the Risk Management Plan (RMP
).
run(rmpt05, syn_data)
RSPT01
)1) The rspt01
template produces the standard best overall response output.
2) The template syntax is built based on RECIST 1.1
. By default, the subjects with response results of "CR"
or "PR"
are considered as responders.
3) Users are expected to pre-process the input analysis data and select the parameter to be analyzed, i.e., best overall response by investigator or best overall response by BICR
.
4) Unstratified analysis is provided by default.
proc_data <- log_filter(syn_data, PARAMCD == "BESRSPI", "adrs") run(rspt01, proc_data, ref_group = NULL, perform_analysis = "unstrat", strata = NULL)
1) By default, the first level or value of arm_var
(default to "ADSL.ARM"
unless specified) is treated as the reference group without specification.
2) To apply user-defined reference group, please provide the value from the treatment variable to the argument ref_group
, e.g., ref_group = "PLACEBO"
.
3) Since rtables
displays the reference group at the very left column, the order of displayed treatment groups may not be exactly the same as the order factorized, depending on which group is selected as the reference group. See below for examples:
| Factorized trt
order | ref_group
| Displayed trt
order | Reference group used in analysis |
| :---------------------:| :----------:|:---------------------:|:--------------------------------:|
| ARM C, ARM B, ARM A | NULL | ARM C, ARM B, ARM A | ARM C |
| NULL | ARM B | ARM B, ARM A, ARM C | ARM B |
| ARM C, ARM B, ARM A | ARM B | ARM B, ARM C, ARM A | ARM B |
1) The section of Odds Ratio
can be suppressed with the argument odds_ratio = FALSE
.
2) The section of Difference in response rate
can be suppressed with the argument perform_analysis = NULL
.
proc_data <- log_filter(syn_data, PARAMCD == "BESRSPI", "adrs") run(rspt01, proc_data, odds_ratio = FALSE, perform_analysis = NULL)
1) A stratified analysis can be added by specifying the argument perform_analysis = "strat"
and providing the stratification variable to the argument strata
. The argument strata
is expected if perform_analysis
is set to include stratified analysis.
2) The stratification variables are expected to be available in adrs
.
3) If both unstratified and stratified analysis are required, use perform_analysis = c("unstrat", "strat")
proc_data <- log_filter(syn_data, PARAMCD == "BESRSPI", "adrs") run(rspt01, proc_data, perform_analysis = "strat", strata = c("STRATA1", "STRATA2"))
1) The level of the confidence intervals is defined by the argument conf_level
.
2) The methods to construct confidence interval and p-value are controlled by the argument methods
. It is a named list with five optional sub-arguments. For example, methods = list(prop_conf_method = "wald", diff_conf_method = "wald", strat_diff_conf_method = "ha", diff_pval_method = "fisher", strat_diff_pval_method = "schouten")
See table below for what each argument controls and the available method options:
| Arguments | Methods Controlled | Methods Options |
| :-----------------------:| :------------------------------------------:|:------------------------------------:|
| prop_conf_method
| proportion confidence interval | "waldcc"
(default), "wald"
, etc. |
| diff_conf_method
| unstratified difference confidence interval | "waldcc"
(default), "wald"
, etc. |
| diff_pval_method
| unstratified p-value for odds ratio | "chisq"
(default), "fisher"
|
| strat_diff_conf_method
| stratified difference confidence interval | "cmh"
(default), "ha"
|
| strat_diff_pval_method
| stratified p-value for odds ratio | "cmh"
(default), "schouten"
|
See in the table below the method options for estimates of proportions and the associated statistical methods:
| Method Options | Statistical Methods |
| :------------------:| :------------------------------------:|
| "clopper-pearson"
| Clopper-Pearson |
| "wald"
| Wald, without correction |
| "waldcc"
| Wald, with correction |
| "wilson"
| Wilson, without correction |
| "strat_wilson"
| Stratified Wilson, without correction |
| "wilsonc"
| Wilson, with correction |
| "strat_wilsonc"
| Stratified Wilson, with correction |
| "agresti-coull"
| Agresti-Coull |
| "jeffreys"
| Jeffreys |
See in the table below the method options for estimates of proportion difference and the associated statistical methods:
| Method Options | Statistical Methods |
| :-------------------:| :--------------------------------------:|
| "cmh"
| CMH
, without correction |
| "wald"
| Wald, with correction |
| "waldcc"
| Wald, without correction |
| "ha"
| Anderson-Hauck |
| "newcombe"
| Newcombe, without correction |
| "newcombecc"
| Newcombe, with correction |
| "strat_wilsonc"
| Stratified Wilson, with correction |
| "strat_newcombe"
| Stratified Newcombe, without correction |
| "strat_newcombecc"
| Stratified Newcombe, with correction |
See in the table below the method options for testing proportion difference and the associated statistical methods:
| Method Options | Statistical Methods |
| :-------------:| :----------------------------------------:|
| "chisq"
| Chi-Squared test |
| "fisher"
| the Fisher's exact test |
| "cmh"
| stratified Cochran-Mantel-Haenszel test |
| "shouten"
| Chi-Squared test with Schouten correction |
An example:
proc_data <- log_filter(syn_data, PARAMCD == "BESRSPI", "adrs") run(rspt01, proc_data, conf_level = 0.90, methods = list( prop_conf_method = "wald", diff_conf_method = "wald", diff_pval_method = "fisher" ) )
The following example shows how to customize the definition of responder, e.g, consider only complete response as response.
proc_data <- log_filter(syn_data, PARAMCD == "BESRSPI", "adrs") preprocess(rspt01) <- function(adam_db, ...) { adam_db$adrs <- adam_db$adrs %>% mutate(RSP_LAB = tern::d_onco_rsp_label(.data$AVALC)) %>% mutate(IS_RSP = .data$AVALC %in% c("CR")) adam_db } run(rspt01, proc_data)
TTET01
)1) The ttet01
template produces the standard time-to-event summary.
2) Users are expected to subset the parameter of interest (e.g. PARAMCD == "PFS"
) in pre-processing.
3) Please see the section of Best Overall Response (Ordering of treatment groups) to find out more about the ordering of treatment groups and reference group.
4) Unstratified analysis is provided by default.
5) Survival estimations and difference in survival are both provided by default.
proc_data <- log_filter(syn_data, PARAMCD == "PFS", "adtte") run(ttet01, proc_data)
To suspend the section of earliest contributing events, use summarize_event = FALSE
.
proc_data <- log_filter(syn_data, PARAMCD == "PFS", "adtte") run(ttet01, proc_data, summarize_event = FALSE)
To select either survival estimations or difference in survival or both, please specify in the argument method
.
- surv
calls out the analysis of patients remaining at risk, event free rate and corresponding 95% confidence interval of the rates.
- surv_diff
calls out the analysis of difference in event free rate, the 95% confidence interval of the difference and its corresponding p-value.
- both
calls out both.
proc_data <- log_filter(syn_data, PARAMCD == "PFS", "adtte") run(ttet01, proc_data, method = "surv")
1) The level of the confidence intervals is defined by the argument conf_level
.
2) The type of confidence interval is defined in the argument conf_type
. Options are "plain"
(default), "log"
and "log-log"
.
3) Handling of ties is specified in the argument ties
. Options are "efron"
(default),"breslow"
or "exact"
.
proc_data <- log_filter(syn_data, PARAMCD == "PFS", "adtte") run(ttet01, proc_data, conf_level = 0.90, conf_type = "log-log", ties = "efron")
1) A stratified analysis can be added by specifying the argument perform_analysis = "strat"
and providing the stratification variable to the argument strata
. The argument strata
is expected if perform_analysis
is set to include stratified analysis.
2) The stratification variables are expected to be available in adrs
.
3) If unstratified and stratified analysis are both required, users can use perform_analysis = c("unstrat", "strat")
.
proc_data <- log_filter(syn_data, PARAMCD == "PFS", "adtte") run(ttet01, proc_data, perform_analysis = "strat", strata = "STRATA1")
The time point for the "survival at xx months" analysis can be modified by specifying the argument time_point
. By default, the function takes AVAL
from adtte
in days and converts it to months. The survival estimates are then summarized in month, and the numeric values should be provided in months to time_point
.
proc_data <- log_filter(syn_data, PARAMCD == "PFS", "adtte") run(ttet01, proc_data, perform_analysis = "unstrat", time_point = c(3, 6))
The following example shows how to specify the time point in user-defined unit.
proc_data <- log_filter(syn_data, PARAMCD == "PFS", "adtte") preprocess(ttet01) <- function(adam_db, dataset = "adtte", ...) { adam_db[[dataset]] <- adam_db[[dataset]] %>% mutate( AVALU = "DAYS", IS_EVENT = .data$CNSR == 0, IS_NOT_EVENT = .data$CNSR == 1, EVNT1 = factor( case_when( IS_EVENT == TRUE ~ render_safe("{Patient_label} with event (%)"), IS_EVENT == FALSE ~ render_safe("{Patient_label} without event (%)") ), levels = render_safe(c("{Patient_label} with event (%)", "{Patient_label} without event (%)")) ), EVNTDESC = factor(.data$EVNTDESC) ) adam_db } run(ttet01, proc_data, perform_analysis = "unstrat", time_point = c(91, 183))
The default p-value method for testing hazard ratio is "log-rank". Alternative methods can be requested by specifying the argument pval_method
and options include, log-rank
(default), wald
or likelihood
. The syntax currently does not allow requesting more than one p-value.
Note that ttet01
has been modified in the previous example (i.e., preprocess(ttet01)
has been overridden); to access the default template, try chevron::ttet01
.
proc_data <- log_filter(syn_data, PARAMCD == "PFS", "adtte") run(ttet01, proc_data, pval_method = "wald")
VST01
)t_vs_chg <- run(vst01, syn_data) head(t_vs_chg, 20)
VST02_1
)run(vst02_1, syn_data)
VST02_2
)run(vst02_2, syn_data)
AEL01_NOLLT
)1) The ael01_nollt
template produces the standard glossary of adverse event preferred terms and investigator-specified terms.
2) The example below uses head
function to print only the first 10 lines of the output.
l_ae_nollt <- run(ael01_nollt, syn_data) head(l_ae_nollt, 10)
FSTG01
)1) The fstg01
template produces the standard forest plot for odds ratio.
2) Users are expected to subset the parameter of interest (e.g. PARAMCD == "BESRSPI"
) in pre-processing.
3) Users are expected to subset the arm variable to keep only the two arms to compare (e.g. ARM %in% c("A: Drug X", "B: Placebo")
).
4) By default, the plots displays a subgroup analysis for "SEX"
, "AGEGR1"
and "RACE"
.
5) Unstratified analysis is provided by default.
6) The plots displays by default the Total number of subjects, the odd ratio and the 95% confidence interval, and, for each arm, the number of subject, the number of responders and the proportion of responders.
proc_data <- log_filter( syn_data, PARAMCD == "BESRSPI" & ARM %in% c("A: Drug X", "B: Placebo"), "adrs" ) run(fstg01, proc_data)
The confidence level of the confidence interval can be adjusted by the conf_level
argument.
run(fstg01, proc_data, conf_level = 0.90)
The interaction p-values and a different set of statistics can be displayed using the stat_var
argument. Note that the users are expected to select a method for p-value computation. see [tern::prop_diff_test]
.
run(fstg01, proc_data, method = "fisher", stat_var = c("n_tot", "n", "ci", "or", "pval"))
The subgroups
arguments controls which variables are used for subgroup analysis. If NULL
the subgroup analysis is removed.
run(fstg01, proc_data, subgroups = NULL)
The strata_var
argument is used to pass the columns used for stratified analysis.
run(fstg01, proc_data, strata_var = "STRATA1")
The col_symbol_size
argument controls the size of the odds ratio symbols which are by default proportional in size to the sample size of the subgroup. If NULL
the same symbol size is used for all subgroups.
run(fstg01, proc_data, col_symbol_size = NULL)
FSTG02
)1) The fstg02
template produces the standard forest plot for hazard ratio.
2) Users are expected to subset the parameter of interest (e.g. PARAMCD == "OS"
) in pre-processing.
3) Users are expected to subset the arm variable to keep only the two arms to compare (e.g. ARM %in% c("A: Drug X", "B: Placebo")
).
4) By default, the plots displays a subgroup analysis for "SEX"
, "AGEGR1"
and "RACE"
.
5) Unstratified analysis is provided by default.
6) The plots displays by default the Total number of events, the hazard ratio and the 95% confidence interval, and, for each arm, the number of events and the median time to event in month.
proc_data <- log_filter( syn_data, PARAMCD == "OS" & ARM %in% c("A: Drug X", "B: Placebo"), "adtte" ) run(fstg02, proc_data)
The interaction p-values and a different set of statistics can be displayed using the control
argument. More details about the control options are available in [tern::extract_survival_subgroups]
run( fstg02, proc_data, stat_var = c("n_tot", "n", "ci", "hr", "pval"), control = list(conf_level = 0.9, pval_method = "likelihood") )
The subgroups
arguments controls which variables are used for subgroup analysis. If NULL
the subgroup analysis is removed.
run(fstg02, proc_data, subgroups = NULL)
The strata_var
argument is used to pass the columns used for stratified analysis.
run(fstg02, proc_data, strata_var = "STRATA1")
The col_symbol_size
argument controls the size of the hazard ratio symbols which are by default proportional in size to the number of events in the subgroup. If NULL
the same symbol size is used for all subgroups.
run(fstg02, proc_data, col_symbol_size = NULL)
KMG01
)1) The kmg01
template produces the standard Kaplan-Meier Plot.
2) Users are expected to select a particular parameter for analysis.
3) Users are expected to select the treatment groups to compare, otherwise, all treatment groups available in the input datasets will be plotted.
4) The comparative statistics are not included by default.
5) The estimation of median survival time per treatment group by default.
6) More arguments in the g_km
and control_coxph
functions can be passed through, please use the Help to find out more information.
proc_data <- log_filter(syn_data, PARAMCD == "OS", "adtte") run(kmg01, proc_data, dataset = "adtte")
To enable the comparative statistics (hazard ratio and p-value), the argument annot_coxph
needs to be set to TRUE. The compare group is determined by the levels in the factorized variable of treatment group and the first level is used as reference group in the statistics.
proc_data <- log_filter(syn_data, PARAMCD == "OS", "adtte") run( kmg01, proc_data, dataset = "adtte", annot_coxph = TRUE, control_annot_coxph = tern::control_coxph_annot(x = 0.33, y = 0.42) )
To suppress the censoring marks, set the argument cencor_show
to FALSE.
proc_data <- log_filter(syn_data, PARAMCD == "OS", "adtte") run(kmg01, proc_data, dataset = "adtte", censor_show = FALSE)
proc_data <- log_filter(syn_data, PARAMCD == "OS", "adtte") run(kmg01, proc_data, dataset = "adtte", annot_surv_med = FALSE)
To add the statistics annotation, use the function annot_stats
. Options are min
or median
.
proc_data <- log_filter(syn_data, PARAMCD == "OS", "adtte") run(kmg01, proc_data, dataset = "adtte", annot_stats = "median") run(kmg01, proc_data, dataset = "adtte", annot_stats = c("min", "median"))
proc_data <- log_filter(syn_data, PARAMCD == "OS", "adtte") run(kmg01, proc_data, dataset = "adtte", annot_at_risk = FALSE)
MNG01
)1) The mng01
template produces the standard mean plot.
2) Note that the template mng01
is quite general. The users are expected to specify the analysis dataset and the visit variable in the run
function, and select the parameters prior to the run
function.
3) The table of summary statistics is included by default.
4) The variable Analysis Value AVAL
is used for plotting by default.
5) If the input dataset contains results of the same analyses in multiple units,(e.g. SI/CV units in ADLB
), please make sure that the parameters in appropriate units are selected in advance.
proc_data <- log_filter(syn_data, PARAMCD == "DIABP", "advs") run(mng01, proc_data, dataset = "advs", x_var = c("AVISIT", "AVISITN"))
proc_data <- log_filter(syn_data, PARAMCD == "DIABP", "advs") run(mng01, proc_data, dataset = "advs", x_var = c("AVISIT", "AVISITN"), y_var = "CHG")
To change the statistics, use the argument interval_fun
. Options are mean_ci
, mean_sei
, mean_sdi
, median_ci
, quantiles
,range
.
proc_data <- log_filter(syn_data, PARAMCD == "DIABP", "advs") run(mng01, proc_data, dataset = "advs", x_var = c("AVISIT", "AVISITN"), interval_fun = "mean_sdi")
To change the alpha level of the confidence interval, use the argument control = control_analyze_vars(conf_level = <0.xx>)
. Note that this is only in effect when interval_fun
is set to mean_ci
.
proc_data <- log_filter(syn_data, PARAMCD == "DIABP", "advs") run( mng01, proc_data, dataset = "advs", x_var = c("AVISIT", "AVISITN"), interval_fun = "mean_ci", control = tern::control_analyze_vars(conf_level = 0.80) )
proc_data <- log_filter(syn_data, PARAMCD == "DIABP", "advs") run(mng01, proc_data, dataset = "advs", x_var = c("AVISIT", "AVISITN"), table = "n")
proc_data <- log_filter(syn_data, PARAMCD == "DIABP", "advs") run(mng01, proc_data, dataset = "advs", x_var = c("AVISIT", "AVISITN"), table = NULL)
A new argument has been added to control the theme (e.g. setting the angle of the axis); see an example below:
ggtheme <- ggplot2::theme( panel.grid = ggplot2::element_line(colour = "black", linetype = 3), panel.background = ggplot2::element_rect(fill = "white"), legend.position = "top", axis.text.x = ggplot2::element_text(angle = 22, hjust = 1, vjust = 1) ) run(mng01, syn_data, dataset = "adlb", ggtheme = ggtheme)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.