|
| 1 | +--- |
| 2 | +title: "Display Only SOC in the AE-Specific Tables" |
| 3 | +authors: "Hiroaki Fukuda" |
| 4 | +output: |
| 5 | + rmarkdown::html_document: |
| 6 | + self_contained: no |
| 7 | + number_sections: yes |
| 8 | + code_folding: hide |
| 9 | +vignette: | |
| 10 | + %\VignetteIndexEntry{Display Only SOC in the AE-Specific Tables} |
| 11 | + %\VignetteEngine{knitr::rmarkdown} |
| 12 | + %\VignetteEncoding{UTF-8} |
| 13 | +--- |
| 14 | + |
| 15 | +```{r, include = FALSE} |
| 16 | +knitr::opts_chunk$set( |
| 17 | + collapse = TRUE, |
| 18 | + comment = "#>", |
| 19 | + message = FALSE, |
| 20 | + warning = FALSE |
| 21 | +) |
| 22 | +``` |
| 23 | + |
| 24 | +```{r} |
| 25 | +library(forestly) |
| 26 | +library(metalite) |
| 27 | +``` |
| 28 | + |
| 29 | +The interactive AE forest plots include AE-specific tables that present both numerical and visual summaries for each AE SOC/PT terms. In this vignette, we demonstrate how to display only SOC terms in the table. |
| 30 | + |
| 31 | +# Step 1: build your metadata |
| 32 | + |
| 33 | +Building interactive AE forest plots starts with constructing the metadata. The detailed procedure for building metadata is covered in the vignette [Generate Interactive AE Forest Plots with Drill Down to AE Listing](https://merck.github.io/forestly/articles/forestly.html). Therefore, in this vignette, we will skip those details and directly use the metadata created there. |
| 34 | + |
| 35 | +```{r} |
| 36 | +adsl <- forestly_adsl |
| 37 | +adae <- forestly_adae |
| 38 | +
|
| 39 | +adsl$TRTA <- factor(forestly_adsl$TRT01A, |
| 40 | + levels = c("Xanomeline Low Dose", "Placebo"), |
| 41 | + labels = c("Low Dose", "Placebo") |
| 42 | +) |
| 43 | +adae$TRTA <- factor(forestly_adae$TRTA, |
| 44 | + levels = c("Xanomeline Low Dose", "Placebo"), |
| 45 | + labels = c("Low Dose", "Placebo") |
| 46 | +) |
| 47 | +
|
| 48 | +meta <- meta_adam(population = adsl, observation = adae) |> |
| 49 | + define_plan(plan = plan( |
| 50 | + analysis = "ae_forestly", |
| 51 | + population = "apat", |
| 52 | + observation = "apat", |
| 53 | + parameter = "any;drug-related" |
| 54 | + )) |> |
| 55 | + define_analysis(name = "ae_forestly", label = "Interactive Forest Plot") |> |
| 56 | + define_population( |
| 57 | + name = "apat", group = "TRTA", id = "USUBJID", |
| 58 | + subset = SAFFL == "Y", label = "All Patient as Treated" |
| 59 | + ) |> |
| 60 | + define_observation( |
| 61 | + name = "apat", group = "TRTA", |
| 62 | + subset = SAFFL == "Y", label = "All Patient as Treated" |
| 63 | + ) |> |
| 64 | + define_parameter( |
| 65 | + name = "any", |
| 66 | + subset = NULL, |
| 67 | + label = "Any AEs", |
| 68 | + var = "AEDECOD", soc = "AEBODSYS" |
| 69 | + ) |> |
| 70 | + define_parameter( |
| 71 | + name = "drug-related", |
| 72 | + subset = toupper(AREL) == "RELATED", |
| 73 | + label = "Drug-related AEs", |
| 74 | + var = "AEDECOD", soc = "AEBODSYS" |
| 75 | + ) |> |
| 76 | + meta_build() |
| 77 | +``` |
| 78 | + |
| 79 | + |
| 80 | +# Step 2: display only SOC |
| 81 | + |
| 82 | +Users can control the display of SOC and/or PT terms using the `components` = ... argument in the `prepare_ae_forestly()`. |
| 83 | + |
| 84 | +In the example below, we display only SOC terms in the forest plot, so the "Adverse Events" column contains only SOC terms in the table. |
| 85 | + |
| 86 | +```{r} |
| 87 | +meta |> |
| 88 | + prepare_ae_forestly(components = "soc") |> |
| 89 | + format_ae_forestly() |> |
| 90 | + ae_forestly() |
| 91 | +``` |
0 commit comments