library(metalite.ae)
library(metalite)
The purpose of this tutorial is to create production ready AE listing.
The AE listing provides details about the interested adverse events information. With a metadata object created by metalite, there are two required functions to create AE listing tables using metalite.ae:
prepare_ae_listing()
: prepare listing datasets.tlf_ae_listing()
: transfer output dataset to RTF
table.An example output:
In metalite.ae, we created an example dataset using ADSL and ADAE datasets from the metalite package.
<- meta_ae_example()
meta
meta#> ADaM Meta Data:
#> .$data_population Population data with 254 subjects
#> .$data_observation Observation data with 1191 records
#> .$plan Analysis plan with 16 plans
#>
#>
#> Analysis population type:
#> name id group var subset label
#> 1 'apat' 'USUBJID' 'TRTA' SAFFL == 'Y' 'All Participants as Treated'
#>
#>
#> Analysis observation type:
#> name id group var subset label
#> 1 'wk12' 'USUBJID' 'TRTA' SAFFL == 'Y' 'Weeks 0 to 12'
#> 2 'wk24' 'USUBJID' 'TRTA' AOCC01FL == 'Y' 'Weeks 0 to 24'
#>
#>
#> Analysis parameter type:
#> name label
#> 1 'rel' 'drug-related adverse events'
#> 2 'aeosi' 'adverse events of special interest'
#> 3 'any' 'any adverse events'
#> 4 'ser' 'serious adverse events'
#> subset
#> 1 AEREL %in% c('POSSIBLE', 'PROBABLE')
#> 2 AEOSI == 'Y'
#> 3
#> 4 AESER == 'Y'
#>
#>
#> Analysis function:
#> name label
#> 1 'ae_summary' 'Table: adverse event summary'
#> 2 'ae_listing' 'Listing: adverse event'
#> 3 'ae_specific' 'Table: specific adverse event'
The same metadata structure is used to support all analyses examples in metalite.ae. More details can be found on the metalite package website.
The prepare_ae_listing()
function is used to calculate
statistics required for AE listing using pre-specified keywords in
meta
. The input of the function is a meta
object created by metalite. The output of the function is an
outdata
object that contains a list of analysis raw
datasets.
<- prepare_ae_listing(
tbl
meta,analysis = "ae_listing",
population = "apat",
observation = "wk12",
parameter = "ser"
)head(tbl$tbl)
#> USUBJID ASTDY AEDECOD duration
#> 689 01-709-1424 5 SYNCOPE 1 Day
#> 1131 01-718-1170 27 SYNCOPE 2 Day
#> 1173 01-718-1371 38 PARTIAL SEIZURES WITH SECONDARY GENERALISATION 4 Day
#> AESEV AESER related action_taken outcome TRTA
#> 689 MODERATE Y Possible None Resolved High Dose
#> 1131 SEVERE Y Probable None Resolved Low Dose
#> 1173 SEVERE Y None None Resolved High Dose
#> subline
#> 689 Subject ID = 01-709-1424, Gender = M, Race = WHITE, AGE = 77 Years, TRT = High Dose
#> 1131 Subject ID = 01-718-1170, Gender = F, Race = WHITE, AGE = 80 Years, TRT = Low Dose
#> 1173 Subject ID = 01-718-1371, Gender = F, Race = WHITE, AGE = 69 Years, TRT = High Dose
head(tbl$col_name)
#> USUBJID ASTDY
#> "Unique Subject Identifier" "Analysis Start Relative Day"
#> AEDECOD duration
#> "Adverse Event" "Duration"
#> AESEV AESER
#> "Intensity" "Serious"
The last step is to prepare the RTF table using
tlf_ae_listing()
.
<- c(
footnote "Related: Investigator-assessed relationship of the adverse event to study medication. Y = RELATED, N = NOT RELATED",
"Action Taken: Discontinued = DRUG WITHDRAWN, Interrupted = DRUG INTERRUPTED, Reduced = DOSE REDUCED, Increased = DOSE INCREASED, None = DOSE NOT CHANGED, N/A = NOT APPLICABLE.",
"Outcome: Resolved = RECOVERED/RESOLVED, Resolving = RECOVERING/RESOLVING, Sequelae = RECOVERED/RESOLVED WITH SEQUELAE, Not resolved = NOT RECOVERED/NOT RESOLVED.",
"Adverse event terms are from MedDRA Version 25.0."
)
|> tlf_ae_listing(
tbl footnotes = footnote,
orientation = "portrait",
source = "Source: [CDISCpilot: adam-adsl; adae]",
path_outtable = "rtf/ae0listing0ser0wk12.rtf",
path_outdata = NULL
)#> The output is saved in/rtmp/RtmpPhK17m/Rbuild1a125d24fe88/metalite.ae/vignettes/rtf/ae0listing0ser0wk12.rtf