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 5

Duration of Treatment Exposure, Safety Population, Pooled Analyses

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

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

adsl <- random.cdisc.data::cadsl

# Output Table
make_table_05(df = adsl, return_ard = FALSE)
Parameter A: Drug X
N = 1341
B: Placebo
N = 1341
C: Combination
N = 1321
Duration of Treatment, days


    Mean (SD) 961.49 (208.62) 949.45 (223.73) 984.71 (200.08)
    Median (Min, Max) 1,095.75 (392.79, 1,095.75) 1,095.75 (387.34, 1,095.75) 1,095.75 (368.91, 1,095.75)
    Interquartile range 859.95 - 1,095.75 781.56 - 1,095.75 960.34 - 1,095.75
    Total exposure (person years) 105,763.56 (289.56) 100,641.30 (275.54) 109,302.29 (299.25)
Patients Treated, by duration


    Any duration (at least 1 dose) 110 (82.1%) 106 (79.1%) 111 (84.1%)
    <1 month 0 (0.0%) 0 (0.0%) 0 (0.0%)
    >=1 month 110 (82.1%) 106 (79.1%) 111 (84.1%)
    >=3 months 110 (82.1%) 106 (79.1%) 111 (84.1%)
    >=6 months 110 (82.1%) 106 (79.1%) 111 (84.1%)
    >=12 months 110 (82.1%) 106 (79.1%) 111 (84.1%)
1 n (%)
Function Details

make_table_05()


Required variables:

  • df: The variables specified by vars, arm_var, and saffl_var.
  • denominator (if specified): USUBJID and the variables specified by arm_var and saffl_var.
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
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"
id_var (character) Identifier variable used to count the participants within each flag. "USUBJID"
trtsdtm_var (character) Treatment start datetime variable in df. "TRTSDTM"
trtedtm_var (character) Treatment end datetime variable in df. "TRTEDTM"
u_trtdur (character) Unit for duration of treatment. Options are "days", "weeks", "months" and "years". "days"
Source code for this function is available here.
ARD Setup
# Load Libraries & Data
library(cardinal)

adsl <- random.cdisc.data::cadsl

# Create Table & ARD
result <- make_table_05(df = adsl)

# Output ARD
result$ard
{cards} data frame: 63 x 12
   group1 group1_level variable variable_level   context    stat_name stat_label     stat stat_fmt fmt_fn warning error
1     ARM    A: Drug X   TRTDUR                continuo…         mean       Mean  961.487   961.49   <fn>              
2     ARM    A: Drug X   TRTDUR                continuo…           sd         SD  208.615   208.62   <fn>              
3     ARM    A: Drug X   TRTDUR                continuo…       median     Median  1095.75  1095.75   <fn>              
4     ARM    A: Drug X   TRTDUR                continuo…          min        Min  392.788   392.79   <fn>              
5     ARM    A: Drug X   TRTDUR                continuo…          max        Max  1095.75  1095.75   <fn>              
6     ARM    A: Drug X   TRTDUR                continuo…          p25         Q1  859.171   859.17   <fn>              
7     ARM    A: Drug X   TRTDUR                continuo…          p75         Q3  1095.75  1095.75   <fn>              
8     ARM    A: Drug X   TRTDUR                continuo… tot_exposure  tot_expo… 105763.6 105763.6   <fn>              
9     ARM    A: Drug X   TRTDUR                continuo…   person_yrs  person_y…  289.565   289.56   <fn>              
10    ARM    B: Place…   TRTDUR                continuo…         mean       Mean  949.446   949.45   <fn>              
11    ARM    B: Place…   TRTDUR                continuo…           sd         SD  223.727   223.73   <fn>              
12    ARM    B: Place…   TRTDUR                continuo…       median     Median  1095.75  1095.75   <fn>              
13    ARM    B: Place…   TRTDUR                continuo…          min        Min  387.344   387.34   <fn>              
14    ARM    B: Place…   TRTDUR                continuo…          max        Max  1095.75  1095.75   <fn>              
15    ARM    B: Place…   TRTDUR                continuo…          p25         Q1  779.541   779.54   <fn>              
16    ARM    B: Place…   TRTDUR                continuo…          p75         Q3  1095.75  1095.75   <fn>              
17    ARM    B: Place…   TRTDUR                continuo… tot_exposure  tot_expo… 100641.3 100641.3   <fn>              
18    ARM    B: Place…   TRTDUR                continuo…   person_yrs  person_y…  275.541   275.54   <fn>              
19    ARM    C: Combi…   TRTDUR                continuo…         mean       Mean  984.705   984.71   <fn>              
20    ARM    C: Combi…   TRTDUR                continuo…           sd         SD  200.076   200.08   <fn>              
21    ARM    C: Combi…   TRTDUR                continuo…       median     Median  1095.75  1095.75   <fn>              
22    ARM    C: Combi…   TRTDUR                continuo…          min        Min  368.909   368.91   <fn>              
23    ARM    C: Combi…   TRTDUR                continuo…          max        Max  1095.75  1095.75   <fn>              
24    ARM    C: Combi…   TRTDUR                continuo…          p25         Q1   940.39   940.39   <fn>              
25    ARM    C: Combi…   TRTDUR                continuo…          p75         Q3  1095.75  1095.75   <fn>              
26    ARM    C: Combi…   TRTDUR                continuo… tot_exposure  tot_expo… 109302.3 109302.3   <fn>              
27    ARM    C: Combi…   TRTDUR                continuo…   person_yrs  person_y…  299.253   299.25   <fn>              
28    ARM    A: Drug X    D_ANY           TRUE dichotom…            n          n      110     NULL      0              
29    ARM    A: Drug X    D_ANY           TRUE dichotom…            p          %    0.821     NULL   <fn>              
30    ARM    A: Drug X    D_LT1           TRUE dichotom…            n          n        0     NULL      0              
31    ARM    A: Drug X    D_LT1           TRUE dichotom…            p          %        0     NULL   <fn>              
32    ARM    A: Drug X    D_GT1           TRUE dichotom…            n          n      110     NULL      0              
33    ARM    A: Drug X    D_GT1           TRUE dichotom…            p          %    0.821     NULL   <fn>              
34    ARM    A: Drug X    D_GT3           TRUE dichotom…            n          n      110     NULL      0              
35    ARM    A: Drug X    D_GT3           TRUE dichotom…            p          %    0.821     NULL   <fn>              
36    ARM    A: Drug X    D_GT6           TRUE dichotom…            n          n      110     NULL      0              
37    ARM    A: Drug X    D_GT6           TRUE dichotom…            p          %    0.821     NULL   <fn>              
38    ARM    A: Drug X   D_GT12           TRUE dichotom…            n          n      110     NULL      0              
39    ARM    A: Drug X   D_GT12           TRUE dichotom…            p          %    0.821     NULL   <fn>              
40    ARM    B: Place…    D_ANY           TRUE dichotom…            n          n      106     NULL      0              
41    ARM    B: Place…    D_ANY           TRUE dichotom…            p          %    0.791     NULL   <fn>              
42    ARM    B: Place…    D_LT1           TRUE dichotom…            n          n        0     NULL      0              
43    ARM    B: Place…    D_LT1           TRUE dichotom…            p          %        0     NULL   <fn>              
44    ARM    B: Place…    D_GT1           TRUE dichotom…            n          n      106     NULL      0              
45    ARM    B: Place…    D_GT1           TRUE dichotom…            p          %    0.791     NULL   <fn>              
46    ARM    B: Place…    D_GT3           TRUE dichotom…            n          n      106     NULL      0              
47    ARM    B: Place…    D_GT3           TRUE dichotom…            p          %    0.791     NULL   <fn>              
48    ARM    B: Place…    D_GT6           TRUE dichotom…            n          n      106     NULL      0              
49    ARM    B: Place…    D_GT6           TRUE dichotom…            p          %    0.791     NULL   <fn>              
50    ARM    B: Place…   D_GT12           TRUE dichotom…            n          n      106     NULL      0              
51    ARM    B: Place…   D_GT12           TRUE dichotom…            p          %    0.791     NULL   <fn>              
52    ARM    C: Combi…    D_ANY           TRUE dichotom…            n          n      111     NULL      0              
53    ARM    C: Combi…    D_ANY           TRUE dichotom…            p          %    0.841     NULL   <fn>              
54    ARM    C: Combi…    D_LT1           TRUE dichotom…            n          n        0     NULL      0              
55    ARM    C: Combi…    D_LT1           TRUE dichotom…            p          %        0     NULL   <fn>              
56    ARM    C: Combi…    D_GT1           TRUE dichotom…            n          n      111     NULL      0              
57    ARM    C: Combi…    D_GT1           TRUE dichotom…            p          %    0.841     NULL   <fn>              
58    ARM    C: Combi…    D_GT3           TRUE dichotom…            n          n      111     NULL      0              
59    ARM    C: Combi…    D_GT3           TRUE dichotom…            p          %    0.841     NULL   <fn>              
60    ARM    C: Combi…    D_GT6           TRUE dichotom…            n          n      111     NULL      0              
61    ARM    C: Combi…    D_GT6           TRUE dichotom…            p          %    0.841     NULL   <fn>              
62    ARM    C: Combi…   D_GT12           TRUE dichotom…            n          n      111     NULL      0              
63    ARM    C: Combi…   D_GT12           TRUE dichotom…            p          %    0.841     NULL   <fn>              
rtables Table Setup
# Load Libraries & Data
library(cardinal)

adsl <- random.cdisc.data::cadsl

# Output Table
risk_diff <- list(arm_x = "B: Placebo", arm_y = "A: Drug X") # optional
make_table_05_rtables(df = adsl, risk_diff = risk_diff)
                                           A: Drug X                    B: Placebo                 C: Combination         Risk Difference (%) (95% CI)
Parameter                                   (N=134)                      (N=134)                      (N=132)                       (N=268)           
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Duration of Treatment, days                                                                                                                           
  Mean (SD)                             961.49 (208.62)              949.45 (223.73)              984.71 (200.08)                      NA             
  Median (min - max)               1095.75 (392.79 - 1095.75)   1095.75 (387.34 - 1095.75)   1095.75 (368.91 - 1095.75)                NA             
  Interquartile range                   859.95 - 1095.75             781.56 - 1095.75             960.34 - 1095.75                     NA             
  Total exposure (person years)        105763.56 (289.56)           100641.30 (275.54)           109302.29 (299.25)                    NA             
Patients Treated, by duration                                                                                                                         
  Any duration (at least 1 dose)          110 (82.1%)                  106 (79.1%)                  111 (84.1%)                -3.0 (-12.4 - 6.5)     
  <1 month                                     0                            0                            0                      0.0 (0.0 - 0.0)       
  >=1 month                               110 (82.1%)                  106 (79.1%)                  111 (84.1%)                -3.0 (-12.4 - 6.5)     
  >=3 months                              110 (82.1%)                  106 (79.1%)                  111 (84.1%)                -3.0 (-12.4 - 6.5)     
  >=6 months                              110 (82.1%)                  106 (79.1%)                  111 (84.1%)                -3.0 (-12.4 - 6.5)     
  >=12 months                             110 (82.1%)                  106 (79.1%)                  111 (84.1%)                -3.0 (-12.4 - 6.5)     
Function Details

make_table_05_rtables()


Required variables:

  • df: The variables specified by vars, arm_var, and saffl_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 ADSL) required to build table. No default
alt_counts_df (character) Alternative dataset used only to calculate column counts. NULL
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"
id_var (character) Identifier variable used to count the participants within each flag. "USUBJID"
trtsdtm_var (character) Treatment start datetime variable in df. "TRTSDTM"
trtedtm_var (character) Treatment end datetime variable in df. "TRTEDTM"
u_trtdur (character) Unit for duration of treatment. Options are "days", "weeks", "months" and "years". "days"
lbl_trtdur (character) Label for treatment duration variable u_trtdur. paste("Duration of Treatment,", u_trtdur)
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. TRUE
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 5
subtitle: Duration of Treatment Exposure, Safety Population, Pooled Analyses
---

::: panel-tabset
## Spec. Screenshot

![](../assets/images/screenshots/table_05.png){fig-align="center"}

## gtsummary Table

<details>
  <summary>gtsummary Table Setup</summary>
```{r tbl2, eval=FALSE, echo=TRUE}
# Load Libraries & Data
library(cardinal)

adsl <- random.cdisc.data::cadsl

# Output Table
make_table_05(df = adsl, return_ard = FALSE)
```
</details>

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

<details>
  <summary>Function Details</summary>
### `make_table_05()`

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

Required variables:

-   **`df`**: The variables specified by `vars`, `arm_var`, and `saffl_var`.
-   **`denominator`** (if specified): `USUBJID` and the variables specified by `arm_var` and `saffl_var`.

|                 |                                                                                                          |              |
|-----------------|----------------------------------------------------------------------------------------------------------|--------------|
| **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`       |
| `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"`    |
| `id_var`        | (`character`) Identifier variable used to count the participants within each flag.                       | `"USUBJID"`  |
| `trtsdtm_var`   | (`character`) Treatment start datetime variable in df.                                                   | `"TRTSDTM"`  |
| `trtedtm_var`   | (`character`) Treatment end datetime variable in df.                                                     | `"TRTEDTM"`  |
| `u_trtdur`      | (`character`) Unit for duration of treatment. Options are `"days"`, `"weeks"`, `"months"` and `"years"`. | `"days"`     |

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

## ARD

<details>
  <summary>ARD Setup</summary>
```{r tbl1, echo=TRUE, message=FALSE, warning=FALSE, results='hide'}
# Load Libraries & Data
library(cardinal)

adsl <- random.cdisc.data::cadsl

# Create Table & ARD
result <- make_table_05(df = adsl)

# Output ARD
result$ard
```
</details>

```{r tbl1-print, echo=FALSE}
options(width = 9999)
print(result$ard, columns = "all", n = Inf)
```

## rtables Table

<details>
  <summary>rtables Table Setup</summary>
```{r tbl3, eval=FALSE, echo=TRUE}
# Load Libraries & Data
library(cardinal)

adsl <- random.cdisc.data::cadsl

# Output Table
risk_diff <- list(arm_x = "B: Placebo", arm_y = "A: Drug X") # optional
make_table_05_rtables(df = adsl, risk_diff = risk_diff)
```
</details>

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

<details>
  <summary>Function Details</summary>
### `make_table_05_rtables()`

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

Required variables:

-   **`df`**: The variables specified by `vars`, `arm_var`, and `saffl_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 ADSL) required to build table.                                                                                                                                                                                               | *No default*                                |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
| `alt_counts_df` | (`character`) Alternative dataset used only to calculate column counts.                                                                                                                                                                                        | `NULL`                                      |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
| `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"`                                   |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
| `id_var`        | (`character`) Identifier variable used to count the participants within each flag.                                                                                                                                                                             | `"USUBJID"`                                 |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
| `trtsdtm_var`   | (`character`) Treatment start datetime variable in df.                                                                                                                                                                                                         | `"TRTSDTM"`                                 |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
| `trtedtm_var`   | (`character`) Treatment end datetime variable in df.                                                                                                                                                                                                           | `"TRTEDTM"`                                 |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
| `u_trtdur`      | (`character`) Unit for duration of treatment. Options are `"days"`, `"weeks"`, `"months"` and `"years"`.                                                                                                                                                       | `"days"`                                    |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
| `lbl_trtdur`    | (`character`) Label for treatment duration variable `u_trtdur`.                                                                                                                                                                                                | `paste("Duration of Treatment,", u_trtdur)` |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
| `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.                                                                                                                                                                                               | `TRUE`                                      |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
| `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_05.R).
</details>

:::
 
  • This website as well as code examples are licensed under the Apache License, Version 2.0.
Cookie Preferences