cardinal
  • Home
  • Template Library
    • FDA Table 2
    • FDA Table 3
    • FDA Table 4
    • FDA Table 5
    • FDA Table 6
    • FDA Table 7
    • FDA Table 8
    • FDA Table 9
    • FDA Table 10
    • FDA Table 11
    • FDA Table 12
    • FDA Table 13
    • FDA Table 14
    • FDA Table 15
    • FDA Table 16
    • FDA Table 17
    • FDA Table 18
    • FDA Table 20
    • FDA Table 21
    • FDA Table 22
    • FDA Table 32
    • FDA Table 33
    • FDA Table 34
    • FDA Table 35
    • FDA Table 36
    • FDA Figure 1
    • FDA Figure 2
    • FDA Figure 3
    • FDA Figure 14
  • 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)

  • Spec. Screenshot
  • gtsummary Table
  • ARD
  • rtables Table

gtsummary Table Setup
# Load Libraries & Data
library(cardinal)

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

# Output Table
make_table_35(df = adae, denominator = adsl, return_ard = FALSE)
Function Details

make_table_35()


Required variables:

  • df: The variables specified by id_var, arm_var, saffl_var, and soc_var.
  • denominator (if specified): USUBJID and the variables specified by arm_var and saffl_var
  • If both the ARD (return_ard = TRUE) and an overall column (lbl_overall not missing) are requested, a list of two ARDs will be returned: one for the table by groups, and the other for the overall column.
Argument Description Default
df (data.frame) Dataset (typically ADSL) required to build table. No default
return_ard (flag) Whether an ARD should be returned. TRUE
denominator (character) Alternative dataset used only to calculate column counts. NULL
id_var (character) Identifier variable used to count the participants within each flag. "USUBJID"
arm_var (character) Arm variable used to split table into columns. "ARM"
saffl_var (character) Flag variable used to indicate inclusion in safety population. "SAFFL"
soc_var (character) SOC variable from adae to include in the table. "ARBODSYS"
na_level (character) String to represent missing values. "<Missing>"
lbl_overall (character) String to represent the label of an overall column. NULL

Source code for this function is available here.

ARD Setup
# Load Libraries & Data
library(cardinal)

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

# Create Table and ARD
result <- make_table_35(df = adae, denominator = adsl)

# Output ARD
result$ard
$tbl_hierarchical
{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>                   ARM      A: Drug X categori…         n          n   134      134      0                   stat_1
2    <NA>                   ARM      A: Drug X categori…         N          N   400      400      0                   stat_1
3    <NA>                   ARM      A: Drug X categori…         p          % 0.335     33.5   <fn>                   stat_1
4    <NA>                   ARM      B: Place… categori…         n          n   134      134      0                   stat_2
5    <NA>                   ARM      B: Place… categori…         N          N   400      400      0                   stat_2
6    <NA>                   ARM      B: Place… categori…         p          % 0.335     33.5   <fn>                   stat_2
7    <NA>                   ARM      C: Combi… categori…         n          n   132      132      0                   stat_3
8    <NA>                   ARM      C: Combi… categori…         N          N   400      400      0                   stat_3
9    <NA>                   ARM      C: Combi… categori…         p          %  0.33     33.0   <fn>                   stat_3
10    ARM    A: Drug X AEBODSYS         cl A.1 hierarch…         n          n    78       78   <fn>                   stat_1
ℹ 62 more rows
ℹ Use `print(n = ...)` to see more rows
rtables Table Setup
# Load Libraries & Data
library(random.cdisc.data)
library(cardinal)

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

# Output Table
risk_diff <- list(arm_x = "B: Placebo", arm_y = "A: Drug X") # optional
make_table_35_rtables(df = adae, alt_counts_df = adsl, risk_diff = risk_diff)
                             A: Drug X    B: Placebo   C: Combination   Risk Difference (%) (95% CI)
Body System or Organ Class    (N=134)      (N=134)        (N=132)                 (N=268)           
————————————————————————————————————————————————————————————————————————————————————————————————————
cl A.1                       78 (58.2%)   75 (56.0%)     89 (67.4%)          -2.2 (-14.1 - 9.6)     
cl B.2                       79 (59.0%)   74 (55.2%)     85 (64.4%)          -3.7 (-15.6 - 8.1)     
cl D.1                       79 (59.0%)   67 (50.0%)     80 (60.6%)          -9.0 (-20.8 - 2.9)     
cl D.2                       47 (35.1%)   58 (43.3%)     57 (43.2%)          8.2 (-3.4 - 19.9)      
cl B.1                       47 (35.1%)   49 (36.6%)     43 (32.6%)          1.5 (-10.0 - 13.0)     
cl C.2                       35 (26.1%)   48 (35.8%)     55 (41.7%)          9.7 (-1.3 - 20.7)      
cl C.1                       43 (32.1%)   46 (34.3%)     43 (32.6%)          2.2 (-9.0 - 13.5)      
Function Details

make_table_35_rtables()


Required variables:

  • df: USUBJID and the variables specified by arm_var, saffl_var and soc_var.
  • alt_counts_df (if specified): USUBJID and the variables specified by arm_var and saffl_var.
Argument Description Default
df (data.frame) Dataset (typically ADAE) required to build table. No default
alt_counts_df (character) Alternative dataset (typically ADSL) used only to calculate column counts. NULL
show_colcounts (flag) Whether column counts should be printed. TRUE
id_var (character) Subject identifier variable . USUBJID
arm_var (character) Arm variable used to split table into columns. "ARM"
saffl_var (character) Flag variable used to indicate inclusion in safety population. "SAFFL"
soc_var (character) SOC variable from adae to include in the table. "AEDECOD"
lbl_soc_var (character) Label corresponding to SOC variable soc_var to print in the table. formatters::var_labels(adae, fill = TRUE)[soc_var]
lbl_overall (character) If specified, an overall column will be added to the table with the given value as the column label. NULL
risk_diff

(named list) List of settings to apply to add a risk difference column to the table. See tern::add_riskdiff() for more details. List should contain the following elements:

  • arm_x: (required) the name of reference arm.

  • arm_y: (required) the name of the arm to compare to the reference arm.

  • col_label: (optional) label to use for the risk difference column. Defaults to "Risk Difference (%) (95% CI)".

  • pct: (optional) whether the output should be returned as percentages. Defaults to TRUE.

NULL
prune_0 (flag) Whether all-zero rows should be removed from the table. FALSE
annotations (named list of character) List of annotations to add to the table. Valid annotation types are title, subtitles, main_footer, and prov_footer. Each name-value pair should use the annotation type as name and the desired string as value. NULL
Source code for this function is available here.
Source Code
---
title: FDA Table 35
subtitle: Patients With Adverse Events by System Organ Class, Safety Population, Pooled Analysis (or Trial X)
---

```{r setup, echo=FALSE}
```

::: panel-tabset

## Spec. Screenshot

![](../assets/images/screenshots/table_35.png){fig-align="center" width="70%"}

## gtsummary Table

<details>

<summary>gtsummary Table Setup</summary>

```{r tbl1, eval=FALSE, echo=TRUE}
# Load Libraries & Data
library(cardinal)

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

# Output Table
make_table_35(df = adae, denominator = adsl, return_ard = FALSE)
```

</details>

<details>

<summary>Function Details</summary>

### `make_table_35()`

------------------------------------------------------------------------

Required variables:

-   **`df`**: The variables specified by `id_var`, `arm_var`, `saffl_var`, and `soc_var`.
-   **`denominator`** (if specified): `USUBJID` and the variables specified by `arm_var` and `saffl_var`
-   If both the ARD (`return_ard = TRUE`) and an overall column (`lbl_overall` not missing) are requested, a list of two ARDs will be returned: one for the table by groups, and the other for the overall column.

+---------------+------------------------------------------------------------------------------------+---------------+
| **Argument**  | **Description**                                                                    | **Default**   |
+---------------+------------------------------------------------------------------------------------+---------------+
| `df`          | (`data.frame`) Dataset (typically ADSL) required to build table.                   | *No default*  |
+---------------+------------------------------------------------------------------------------------+---------------+
| `return_ard`  | (`flag`) Whether an ARD should be returned.                                        | `TRUE`        |
+---------------+------------------------------------------------------------------------------------+---------------+
| `denominator` | (`character`) Alternative dataset used only to calculate column counts.            | `NULL`        |
+---------------+------------------------------------------------------------------------------------+---------------+
| `id_var`      | (`character`) Identifier variable used to count the participants within each flag. | `"USUBJID"`   |
+---------------+------------------------------------------------------------------------------------+---------------+
| `arm_var`     | (`character`) Arm variable used to split table into columns.                       | `"ARM"`       |
+---------------+------------------------------------------------------------------------------------+---------------+
| `saffl_var`   | (`character`) Flag variable used to indicate inclusion in safety population.       | `"SAFFL"`     |
+---------------+------------------------------------------------------------------------------------+---------------+
| `soc_var`     | (`character`) SOC variable from `adae` to include in the table.                    | `"ARBODSYS"`  |
+---------------+------------------------------------------------------------------------------------+---------------+
| `na_level`    | (`character`) String to represent missing values.                                  | `"<Missing>"` |
+---------------+------------------------------------------------------------------------------------+---------------+
| `lbl_overall` | (`character`) String to represent the label of an overall column.                  | `NULL`        |
+---------------+------------------------------------------------------------------------------------+---------------+

Source code for this function is available [here](https://github.com/pharmaverse/cardinal/blob/main/R/fda-table_35.R).

</details>

## ARD

<details>

<summary>ARD Setup</summary>

```{r tbl2, echo=TRUE, message=FALSE, warning=FALSE, results='hide'}
# Load Libraries & Data
library(cardinal)

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

# Create Table and ARD
result <- make_table_35(df = adae, denominator = adsl)

# Output ARD
result$ard
```

```{r tbl2-print, echo=FALSE}
withr::local_options(width = 9999)
print(result$ard, columns = "all")
```

</details>

## rtables Table

<details>

<summary>rtables Table Setup</summary>

```{r tbl3, eval=FALSE, echo=TRUE}
# Load Libraries & Data
library(random.cdisc.data)
library(cardinal)

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

# Output Table
risk_diff <- list(arm_x = "B: Placebo", arm_y = "A: Drug X") # optional
make_table_35_rtables(df = adae, alt_counts_df = adsl, risk_diff = risk_diff)
```

</details>

```{r tbl3, message=FALSE, warning=FALSE, eval=TRUE}
```

<details>

<summary>Function Details</summary>

### `make_table_35_rtables()`

------------------------------------------------------------------------

Required variables:

-   **`df`**: `USUBJID` and the variables specified by `arm_var`, `saffl_var` and `soc_var`.
-   **`alt_counts_df`** (if specified): `USUBJID` and the variables specified by `arm_var` and `saffl_var`.

+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| **Argument**     | **Description**                                                                                                                                                                                                                                                | **Default**                                          |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `df`             | (`data.frame`) Dataset (typically ADAE) required to build table.                                                                                                                                                                                               | *No default*                                         |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `alt_counts_df`  | (`character`) Alternative dataset (typically ADSL) used only to calculate column counts.                                                                                                                                                                       | `NULL`                                               |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `show_colcounts` | (`flag`) Whether column counts should be printed.                                                                                                                                                                                                              | `TRUE`                                               |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `id_var`         | (`character`) Subject identifier variable       .                                                                                                                                                                                                              | `USUBJID`                                            |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `arm_var`        | (`character`) Arm variable used to split table into columns.                                                                                                                                                                                                   | `"ARM"`                                              |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `saffl_var`      | (`character`) Flag variable used to indicate inclusion in safety population.                                                                                                                                                                                   | `"SAFFL"`                                            |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `soc_var`        | (`character`) SOC variable from `adae` to include in the table.                                                                                                                                                                                                | `"AEDECOD"`                                          |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `lbl_soc_var`    | (`character`) Label corresponding to SOC variable `soc_var` to print in the table.                                                                                                                                                                             | `formatters::var_labels(adae, fill = TRUE)[soc_var]` |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `lbl_overall`    | (`character`) If specified, an overall column will be added to the table with the given value as the column label.                                                                                                                                             | `NULL`                                               |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `risk_diff`      | (named `list`) List of settings to apply to add a risk difference column to the table. See [`tern::add_riskdiff()`](https://insightsengineering.github.io/tern/main/reference/add_riskdiff.html) for more details. List should contain the following elements: | `NULL`                                               |
|                  |                                                                                                                                                                                                                                                                |                                                      |
|                  | -   `arm_x`: (required) the name of reference arm.                                                                                                                                                                                                             |                                                      |
|                  |                                                                                                                                                                                                                                                                |                                                      |
|                  | -   `arm_y`: (required) the name of the arm to compare to the reference arm.                                                                                                                                                                                   |                                                      |
|                  |                                                                                                                                                                                                                                                                |                                                      |
|                  | -   `col_label`: (optional) label to use for the risk difference column. Defaults to `"Risk Difference (%) (95% CI)"`.                                                                                                                                         |                                                      |
|                  |                                                                                                                                                                                                                                                                |                                                      |
|                  | -   `pct`: (optional) whether the output should be returned as percentages. Defaults to `TRUE`.                                                                                                                                                                |                                                      |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `prune_0`        | (`flag`) Whether all-zero rows should be removed from the table.                                                                                                                                                                                               | `FALSE`                                              |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+
| `annotations`    | (named `list` of `character`) List of annotations to add to the table. Valid annotation types are `title`, `subtitles`, `main_footer`, and `prov_footer.` Each name-value pair should use the annotation type as name and the desired string as value.         | `NULL`                                               |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+

Source code for this function is available [here](https://github.com/pharmaverse/cardinal/blob/main/R/fda-table_35.R).
</details>
:::
 
  • This website as well as code examples are licensed under the Apache License, Version 2.0.
Cookie Preferences