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

FDA Table 35

Patients With Adverse Events by System Organ Class, Safety Population, Pooled Analysis (or Trial X)

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

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

adsl <- random.cdisc.data::cadsl
adae <- random.cdisc.data::cadae

# Pre-processing --------------------------------------------
adsl <- adsl %>%
  filter(SAFFL == "Y") # safety population

data <- adae |>
  filter(SAFFL == "Y") # safety population
Code
tbl <- tbl_hierarchical(
  data = data,
  variables = AEBODSYS, # specify SOC variable
  by = TRT01A,
  id = USUBJID,
  denominator = adsl,
  label = AEBODSYS ~ "**System Organ Class**" # update variable label
)

tbl

Code
# Extract ARD from table
ard <- gather_ard(tbl)[[1]]

ard
{cards} data frame: 72 x 13
   group1 group1_level variable variable_level   context stat_name stat_label  stat stat_fmt fmt_fn warning error gts_column
1    <NA>                TRT01A      A: Drug X categori…         n          n   134      134      0                   stat_1
2    <NA>                TRT01A      A: Drug X categori…         N          N   400      400      0                   stat_1
3    <NA>                TRT01A      A: Drug X categori…         p          % 0.335     33.5   <fn>                   stat_1
4    <NA>                TRT01A      B: Place… categori…         n          n   134      134      0                   stat_2
5    <NA>                TRT01A      B: Place… categori…         N          N   400      400      0                   stat_2
6    <NA>                TRT01A      B: Place… categori…         p          % 0.335     33.5   <fn>                   stat_2
7    <NA>                TRT01A      C: Combi… categori…         n          n   132      132      0                   stat_3
8    <NA>                TRT01A      C: Combi… categori…         N          N   400      400      0                   stat_3
9    <NA>                TRT01A      C: Combi… categori…         p          %  0.33     33.0   <fn>                   stat_3
10 TRT01A    A: Drug X AEBODSYS         cl A.1 hierarch…         n          n    78       78   <fn>                   stat_1
11 TRT01A    A: Drug X AEBODSYS         cl A.1 hierarch…         N          N   134      134   <fn>                   stat_1
12 TRT01A    A: Drug X AEBODSYS         cl A.1 hierarch…         p          % 0.582       58   <fn>                   stat_1
13 TRT01A    B: Place… AEBODSYS         cl A.1 hierarch…         n          n    75       75   <fn>                   stat_2
14 TRT01A    B: Place… AEBODSYS         cl A.1 hierarch…         N          N   134      134   <fn>                   stat_2
15 TRT01A    B: Place… AEBODSYS         cl A.1 hierarch…         p          %  0.56       56   <fn>                   stat_2
16 TRT01A    C: Combi… AEBODSYS         cl A.1 hierarch…         n          n    89       89   <fn>                   stat_3
17 TRT01A    C: Combi… AEBODSYS         cl A.1 hierarch…         N          N   132      132   <fn>                   stat_3
18 TRT01A    C: Combi… AEBODSYS         cl A.1 hierarch…         p          % 0.674       67   <fn>                   stat_3
19 TRT01A    A: Drug X AEBODSYS         cl B.1 hierarch…         n          n    47       47   <fn>                   stat_1
20 TRT01A    A: Drug X AEBODSYS         cl B.1 hierarch…         N          N   134      134   <fn>                   stat_1
21 TRT01A    A: Drug X AEBODSYS         cl B.1 hierarch…         p          % 0.351       35   <fn>                   stat_1
22 TRT01A    B: Place… AEBODSYS         cl B.1 hierarch…         n          n    49       49   <fn>                   stat_2
23 TRT01A    B: Place… AEBODSYS         cl B.1 hierarch…         N          N   134      134   <fn>                   stat_2
24 TRT01A    B: Place… AEBODSYS         cl B.1 hierarch…         p          % 0.366       37   <fn>                   stat_2
25 TRT01A    C: Combi… AEBODSYS         cl B.1 hierarch…         n          n    43       43   <fn>                   stat_3
26 TRT01A    C: Combi… AEBODSYS         cl B.1 hierarch…         N          N   132      132   <fn>                   stat_3
27 TRT01A    C: Combi… AEBODSYS         cl B.1 hierarch…         p          % 0.326       33   <fn>                   stat_3
28 TRT01A    A: Drug X AEBODSYS         cl B.2 hierarch…         n          n    79       79   <fn>                   stat_1
29 TRT01A    A: Drug X AEBODSYS         cl B.2 hierarch…         N          N   134      134   <fn>                   stat_1
30 TRT01A    A: Drug X AEBODSYS         cl B.2 hierarch…         p          %  0.59       59   <fn>                   stat_1
31 TRT01A    B: Place… AEBODSYS         cl B.2 hierarch…         n          n    74       74   <fn>                   stat_2
32 TRT01A    B: Place… AEBODSYS         cl B.2 hierarch…         N          N   134      134   <fn>                   stat_2
33 TRT01A    B: Place… AEBODSYS         cl B.2 hierarch…         p          % 0.552       55   <fn>                   stat_2
34 TRT01A    C: Combi… AEBODSYS         cl B.2 hierarch…         n          n    85       85   <fn>                   stat_3
35 TRT01A    C: Combi… AEBODSYS         cl B.2 hierarch…         N          N   132      132   <fn>                   stat_3
36 TRT01A    C: Combi… AEBODSYS         cl B.2 hierarch…         p          % 0.644       64   <fn>                   stat_3
37 TRT01A    A: Drug X AEBODSYS         cl C.1 hierarch…         n          n    43       43   <fn>                   stat_1
38 TRT01A    A: Drug X AEBODSYS         cl C.1 hierarch…         N          N   134      134   <fn>                   stat_1
39 TRT01A    A: Drug X AEBODSYS         cl C.1 hierarch…         p          % 0.321       32   <fn>                   stat_1
40 TRT01A    B: Place… AEBODSYS         cl C.1 hierarch…         n          n    46       46   <fn>                   stat_2
ℹ 32 more rows
ℹ Use `print(n = ...)` to see more rows
Source Code
---
title: FDA Table 35
subtitle: Patients With Adverse Events by System Organ Class, Safety Population, Pooled Analysis (or Trial X)
categories: [table, FDA, safety, adverse events]
---

::: panel-tabset
## Table Preview

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

## Setup

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

adsl <- random.cdisc.data::cadsl
adae <- random.cdisc.data::cadae

# Pre-processing --------------------------------------------
adsl <- adsl %>%
  filter(SAFFL == "Y") # safety population

data <- adae |>
  filter(SAFFL == "Y") # safety population
```

## Build Table

```{r tbl, results = 'hide'}
tbl <- tbl_hierarchical(
  data = data,
  variables = AEBODSYS, # specify SOC variable
  by = TRT01A,
  id = USUBJID,
  denominator = adsl,
  label = AEBODSYS ~ "**System Organ Class**" # update variable label
)

tbl
```

```{r eval=FALSE, include=FALSE}
gt::gtsave(as_gt(tbl), filename = "result.png")
```

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

## Build ARD

```{r ard, message=FALSE, warning=FALSE, results='hide'}
# Extract ARD from table
ard <- gather_ard(tbl)[[1]]

ard
```

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