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

FDA Table 33

Percentage of Patients Meeting Specific Hypotension Levels Postbaseline, Safety Population, Pooled Analysis

table
FDA
safety
vital signs
  • Table Preview
  • Setup
  • Build ARD
  • Build Table

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

adsl <- random.cdisc.data::cadsl
advs <- random.cdisc.data::cadvs

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

data <- advs |>
  filter(
    # safety population
    SAFFL == "Y",
    # diastolic & systolic blood pressure
    PARAMCD %in% c("DIABP", "SYSBP"),
    # post-baseline visits
    AVISITN >= 1
  ) |>
  # analyze minimum values per parameter of each subject
  slice_min(AVAL, n = 1L, by = c(USUBJID, PARAMCD)) |>
  # define analysis value cutoffs per parameter
  mutate(
    SBP90 = PARAMCD == "SYSBP" & AVAL < 90, # SYSBP <90
    DBP60 = PARAMCD == "DIABP" & AVAL < 60 # DIABP <60
  )
Code
ard <- bind_ard(
  ard_dichotomous(
    data,
    variables = c(SBP90, DBP60),
    by = TRT01A,
    statistic = ~ c("n", "p"),
    denominator = adsl
  ),
  # ARD for header N values
  ard_categorical(adsl, variables = TRT01A)
)

ard
{cards} data frame: 21 x 11
   group1 group1_level variable variable_level   context stat_name stat_label  stat fmt_fn warning error
1  TRT01A    A: Drug X    SBP90           TRUE dichotom…         n          n     9      0              
2  TRT01A    A: Drug X    SBP90           TRUE dichotom…         p          % 0.067   <fn>              
3  TRT01A    A: Drug X    DBP60           TRUE dichotom…         n          n    10      0              
4  TRT01A    A: Drug X    DBP60           TRUE dichotom…         p          % 0.075   <fn>              
5  TRT01A    B: Place…    SBP90           TRUE dichotom…         n          n    24      0              
6  TRT01A    B: Place…    SBP90           TRUE dichotom…         p          % 0.179   <fn>              
7  TRT01A    B: Place…    DBP60           TRUE dichotom…         n          n    13      0              
8  TRT01A    B: Place…    DBP60           TRUE dichotom…         p          % 0.097   <fn>              
9  TRT01A    C: Combi…    SBP90           TRUE dichotom…         n          n    12      0              
10 TRT01A    C: Combi…    SBP90           TRUE dichotom…         p          % 0.091   <fn>              
11 TRT01A    C: Combi…    DBP60           TRUE dichotom…         n          n    14      0              
12 TRT01A    C: Combi…    DBP60           TRUE dichotom…         p          % 0.106   <fn>              
13   <NA>                TRT01A      A: Drug X categori…         n          n   134      0              
14   <NA>                TRT01A      A: Drug X categori…         N          N   400      0              
15   <NA>                TRT01A      A: Drug X categori…         p          % 0.335   <fn>              
16   <NA>                TRT01A      B: Place… categori…         n          n   134      0              
17   <NA>                TRT01A      B: Place… categori…         N          N   400      0              
18   <NA>                TRT01A      B: Place… categori…         p          % 0.335   <fn>              
19   <NA>                TRT01A      C: Combi… categori…         n          n   132      0              
20   <NA>                TRT01A      C: Combi… categori…         N          N   400      0              
21   <NA>                TRT01A      C: Combi… categori…         p          %  0.33   <fn>              
Code
tbl <- tbl_ard_summary(
  ard,
  by = TRT01A,
  # Add labels for each range
  label = list(
    SBP90 = "SBP<90",
    DBP60 = "DBP<60"
  )
) |>
  modify_header(
    # Update label, add analysis value units
    label ~ paste0("**Blood Pressure  \n(", data$AVALU[1], ")**"),
    # Add N values to `by` variable labels
    all_stat_cols() ~ "**{level}**  \nN = {n}"
  )

tbl

Source Code
---
title: FDA Table 33
subtitle: Percentage of Patients Meeting Specific Hypotension Levels Postbaseline, Safety Population, Pooled Analysis
categories: [table, FDA, safety, vital signs]
---

::: panel-tabset
## Table Preview

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

## Setup

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

adsl <- random.cdisc.data::cadsl
advs <- random.cdisc.data::cadvs

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

data <- advs |>
  filter(
    # safety population
    SAFFL == "Y",
    # diastolic & systolic blood pressure
    PARAMCD %in% c("DIABP", "SYSBP"),
    # post-baseline visits
    AVISITN >= 1
  ) |>
  # analyze minimum values per parameter of each subject
  slice_min(AVAL, n = 1L, by = c(USUBJID, PARAMCD)) |>
  # define analysis value cutoffs per parameter
  mutate(
    SBP90 = PARAMCD == "SYSBP" & AVAL < 90, # SYSBP <90
    DBP60 = PARAMCD == "DIABP" & AVAL < 60 # DIABP <60
  )
```

## Build ARD

```{r ard, message=FALSE, warning=FALSE, results='hide'}
ard <- bind_ard(
  ard_dichotomous(
    data,
    variables = c(SBP90, DBP60),
    by = TRT01A,
    statistic = ~ c("n", "p"),
    denominator = adsl
  ),
  # ARD for header N values
  ard_categorical(adsl, variables = TRT01A)
)

ard
```

```{r, echo=FALSE}
# Print ARD
withr::local_options(width = 9999)
print(ard, columns = "all", n = 40)
```

## Build Table

```{r tbl, results = 'hide'}
tbl <- tbl_ard_summary(
  ard,
  by = TRT01A,
  # Add labels for each range
  label = list(
    SBP90 = "SBP<90",
    DBP60 = "DBP<60"
  )
) |>
  modify_header(
    # Update label, add analysis value units
    label ~ paste0("**Blood Pressure  \n(", data$AVALU[1], ")**"),
    # Add N values to `by` variable labels
    all_stat_cols() ~ "**{level}**  \nN = {n}"
  )

tbl
```

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

```{r img, echo=FALSE, fig.align='center', out.width='40%'}
```
:::
 
  • This website as well as code examples are licensed under the Apache License, Version 2.0.
Cookie Preferences