Analysis preparation
The function prepare_disposition()
is written to prepare
data for subject disposition analysis.The function takes four
arguments:
Meta is metadata object created by metalite and it contains data from
ADSL. Analysis, Population, and Parameter arguments are used to subset
and process the meta data. They have default values, which rely on the
meta data object.
The function assign default value Analysis to
prepare_disposition
, Population to the population value
associated with the prepare_disposition
analysis in meta
plan, and parameter to the parameter(s) associated with the
prepare_disposition
analysis in meta$plan.
However, the user can also manually specify the analysis, population,
and parameter values when calling the function, if they want to override
the default values.
In the body of the function, it calls another function
prepare_sl_summary
with the same meta, analysis,
population, and parameter arguments. prepare_sl_summary
takes the meta data, subsets it based on the analysis, population, and
parameter values, and then calculates and returns a summary of the
relevant data.
The result of prepare_sl_summary
is then returned as the
result of prepare_disposition
.
The resulting output of the function
prepare_disposition()
comprises a collection of raw
datasets for analysis and reporting.
outdata <- prepare_disposition(meta)
Click to show the output
outdata
#> List of 14
#> $ meta :List of 7
#> $ population : chr "apat"
#> $ observation : chr "apat"
#> $ parameter : chr "disposition;medical-disposition"
#> $ n :'data.frame': 1 obs. of 6 variables:
#> $ order : NULL
#> $ group : chr "TRTA"
#> $ reference_group: NULL
#> $ char_n :List of 2
#> $ char_var : chr [1:2] "EOSSTT" "EOTSTT1"
#> $ char_prop :List of 2
#> $ var_type :List of 2
#> $ group_label : Factor w/ 3 levels "Placebo","Low Dose",..: 1 3 2
#> $ analysis : chr "disp"
parameter
: parameter name
outdata$parameter
#> [1] "disposition;medical-disposition"
n
: number of participants in population
outdata$n
#> name n_1 n_2 n_3 n_9999 var_label
#> 1 Participants in population 86 84 84 254 -----
The resulting dataset contains frequently used statistics, with
variables indexed according to the order specified in
outdata$group
.
outdata$group
#> [1] "TRTA"
char_n
: number of participants completed vs not
completed in each parameter
outdata$char_n
#> [[1]]
#> name Placebo Low Dose High Dose Total var_label
#> 1 Discontinued 14 24 18 56 Trial Disposition
#> 2 Adverse Event 10 15 15 40 Trial Disposition
#> 3 I/E Not Met 0 2 1 3 Trial Disposition
#> 4 Lack of Efficacy 3 5 1 9 Trial Disposition
#> 5 Withdrew Consent 1 2 1 4 Trial Disposition
#> 6 Participants Ongoing 72 60 66 198 Trial Disposition
#>
#> [[2]]
#> name Placebo Low Dose High Dose Total
#> 1 Completed 58 25 27 110
#> 2 Discontinued 28 59 57 144
#> 3 Adverse Event 8 44 40 92
#> 4 Death 2 1 0 3
#> 5 I/E Not Met 1 0 2 3
#> 6 Lack of Efficacy 3 0 1 4
#> 7 Lost to Follow-up 1 1 0 2
#> 8 Physician Decision 1 0 2 3
#> 9 Protocol Violation 1 1 1 3
#> 10 Sponsor Decision 2 2 3 7
#> 11 Withdrew Consent 9 10 8 27
#> var_label
#> 1 Participant Study Medication Disposition
#> 2 Participant Study Medication Disposition
#> 3 Participant Study Medication Disposition
#> 4 Participant Study Medication Disposition
#> 5 Participant Study Medication Disposition
#> 6 Participant Study Medication Disposition
#> 7 Participant Study Medication Disposition
#> 8 Participant Study Medication Disposition
#> 9 Participant Study Medication Disposition
#> 10 Participant Study Medication Disposition
#> 11 Participant Study Medication Disposition
char_var
: name of parameter
outdata$char_var
#> [1] "EOSSTT" "EOTSTT1"
char_prop
: proportion of subject with disposition
outdata$char_prop
#> [[1]]
#> name Placebo Low Dose High Dose
#> 1 Discontinued 16.27907 28.57143 21.42857
#> 2 Adverse Event 11.6279069767442 17.8571428571429 17.8571428571429
#> 3 I/E Not Met 0 2.38095238095238 1.19047619047619
#> 4 Lack of Efficacy 3.48837209302326 5.95238095238095 1.19047619047619
#> 5 Withdrew Consent 1.16279069767442 2.38095238095238 1.19047619047619
#> 6 Participants Ongoing 83.72093 71.42857 78.57143
#> Total var_label
#> 1 22.04724 Trial Disposition
#> 2 15.748031496063 Trial Disposition
#> 3 1.18110236220472 Trial Disposition
#> 4 3.54330708661417 Trial Disposition
#> 5 1.5748031496063 Trial Disposition
#> 6 77.95276 Trial Disposition
#>
#> [[2]]
#> name Placebo Low Dose High Dose
#> 1 Completed 67.44186 29.7619 32.14286
#> 2 Discontinued 32.55814 70.2381 67.85714
#> 3 Adverse Event 9.30232558139535 52.3809523809524 47.6190476190476
#> 4 Death 2.32558139534884 1.19047619047619 0
#> 5 I/E Not Met 1.16279069767442 0 2.38095238095238
#> 6 Lack of Efficacy 3.48837209302326 0 1.19047619047619
#> 7 Lost to Follow-up 1.16279069767442 1.19047619047619 0
#> 8 Physician Decision 1.16279069767442 0 2.38095238095238
#> 9 Protocol Violation 1.16279069767442 1.19047619047619 1.19047619047619
#> 10 Sponsor Decision 2.32558139534884 2.38095238095238 3.57142857142857
#> 11 Withdrew Consent 10.4651162790698 11.9047619047619 9.52380952380952
#> Total var_label
#> 1 43.30709 Participant Study Medication Disposition
#> 2 56.69291 Participant Study Medication Disposition
#> 3 36.2204724409449 Participant Study Medication Disposition
#> 4 1.18110236220472 Participant Study Medication Disposition
#> 5 1.18110236220472 Participant Study Medication Disposition
#> 6 1.5748031496063 Participant Study Medication Disposition
#> 7 0.78740157480315 Participant Study Medication Disposition
#> 8 1.18110236220472 Participant Study Medication Disposition
#> 9 1.18110236220472 Participant Study Medication Disposition
#> 10 2.75590551181102 Participant Study Medication Disposition
#> 11 10.6299212598425 Participant Study Medication Disposition
RTF tables
The last step is to prepare the RTF table using
rtf_trt_compliance
.
outdata$tbl <- outdata$tbl %>%
mutate(name = ifelse(trimws(name) == "Status Not Recorded", " Status Not Recorded", name))
outdata |>
rtf_disposition(
"Source: [CDISCpilot: adam-adsl]",
path_outdata = tempfile(fileext = ".Rdata"),
path_outtable = "outtable/disposition.rtf"
)
#> The outdata is saved in/rtmp/RtmpkBEdeP/file3606c1be370f0.Rdata
#> The output is saved in/rtmp/Rtmp7YMja5/Rbuild3605e43666ac3c/metalite.sl/vignettes/outtable/disposition.rtf