Cardinal
  • Home
  • Template Catalog
  • About
  • Resources
  • Help
    • Getting Started
    • Report a Bug
    • FAQ

Subjects With Serious Adverse Events by System Organ Class and Preferred Term, Safety Population, Pooled Analysis (or Trial X)

FDA Table 10

table
FDA
safety
adverse events
  • Table Preview
  • Setup
  • Build Table
  • Build ARD

Code
# Load libraries & data -------------------------------------
library(dplyr)
library(gtsummary)

adsl <- pharmaverseadam::adsl
adae <- pharmaverseadam::adae

# Pre-processing --------------------------------------------
adae <- adae |>
  filter(
    # safety population
    SAFFL == "Y",
    # serious adverse events
    AESER == "Y"
  )
Code
tbl <- adae |>
  tbl_hierarchical(
    variables = c(AESOC, AEDECOD),
    by = TRT01A,
    id = USUBJID,
    denominator = adsl,
    overall_row = TRUE,
    label = "..ard_hierarchical_overall.." ~ "Any SAE"
  )

tbl

Code
ard <- gather_ard(tbl)
ard
$tbl_hierarchical
{cards} data frame: 36 x 15
   group1 group1_level group2 group2_level variable variable_level  context stat_name stat_label  stat stat_fmt fmt_fun warning error gts_column
1    <NA>                <NA>                TRT01A        Placebo tabulate         n          n    86       86       0                   stat_1
2    <NA>                <NA>                TRT01A        Placebo tabulate         N          N   306      306       0                   stat_1
3    <NA>                <NA>                TRT01A        Placebo tabulate         p          % 0.281     28.1    <fn>                   stat_1
4    <NA>                <NA>                TRT01A      Screen F… tabulate         n          n    52       52       0                   stat_2
5    <NA>                <NA>                TRT01A      Screen F… tabulate         N          N   306      306       0                   stat_2
6    <NA>                <NA>                TRT01A      Screen F… tabulate         p          %  0.17     17.0    <fn>                   stat_2
7    <NA>                <NA>                TRT01A      Xanomeli… tabulate         n          n    72       72       0                   stat_3
8    <NA>                <NA>                TRT01A      Xanomeli… tabulate         N          N   306      306       0                   stat_3
9    <NA>                <NA>                TRT01A      Xanomeli… tabulate         p          % 0.235     23.5    <fn>                   stat_3
10   <NA>                <NA>                TRT01A      Xanomeli… tabulate         n          n    96       96       0                   stat_4
ℹ 26 more rows
ℹ Use `print(n = ...)` to see more rows
Source Code
---
title: Subjects With Serious Adverse Events by System Organ Class and Preferred Term, Safety Population, Pooled Analysis (or Trial X)
subtitle: FDA Table 10
categories: [table, FDA, safety, adverse events]
---

::: panel-tabset
## Table Preview

```{r img, echo=FALSE, fig.align='center', out.width='60%'}
knitr::include_graphics("result.png")
```

## Setup

```{r setup, message=FALSE}
# Load libraries & data -------------------------------------
library(dplyr)
library(gtsummary)

adsl <- pharmaverseadam::adsl
adae <- pharmaverseadam::adae

# Pre-processing --------------------------------------------
adae <- adae |>
  filter(
    # safety population
    SAFFL == "Y",
    # serious adverse events
    AESER == "Y"
  )
```

## Build Table

```{r tbl, results='hide'}
tbl <- adae |>
  tbl_hierarchical(
    variables = c(AESOC, AEDECOD),
    by = TRT01A,
    id = USUBJID,
    denominator = adsl,
    overall_row = TRUE,
    label = "..ard_hierarchical_overall.." ~ "Any SAE"
  )

tbl
```

```{r eval=FALSE, include=FALSE}
# Run chunk locally to generate image file
gt::gtsave(as_gt(tbl), filename = "result.png")
```

```{r img, echo=FALSE, fig.align='center', out.width='60%'}
```

## Build ARD

```{r ard, message=FALSE, warning=FALSE, results='hide'}
ard <- gather_ard(tbl)
ard
```

```{r, echo=FALSE}
# Print full ARD
withr::local_options(width = 9999)
print(ard, columns = "all")
```
:::
 
  • This website as well as code examples are licensed under the Apache License, Version 2.0.
Cookie Preferences