Skip to content

Commit 1bc0cce

Browse files
authored
Merge pull request #108 from Merck/105-ae-listing-does-not-work-when-view-by-soc
Add vignette explaining how to control display terms
2 parents c9ffc50 + c613ea6 commit 1bc0cce

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

_pkgdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ articles:
3939
- customize-diff-label
4040
- customize-xlimit
4141
- customize-width
42+
- customize-display-only-soc
4243
- title: Developer Notes
4344
contents:
4445
- design-pattern
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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

Comments
 (0)