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 11

Patients with FDA Medical Query (Narrow) Leading to Treatment Discontinuation, Safety Population, Pooled Analyses

  • 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

# Pre-Processing - Ensure required variables fmqsc_var and fmqnam_var exist in adae
set.seed(1)
adae <- adae |>
  dplyr::rename(FMQ01SC = SMQ01SC) |>
  dplyr::mutate(
    AESER = sample(c("Y", "N"), size = nrow(adae), replace = TRUE),
    FMQ01NAM = sample(c("FMQ1", "FMQ2", "FMQ3"), size = nrow(adae), replace = TRUE)
  )
adae$DCSREAS[is.na(adae$DCSREAS)] <- "ADVERSE EVENT"
adae$FMQ01SC[is.na(adae$FMQ01SC)] <- "NARROW"

# Output Table
make_table_11(df = adae, denominator = adsl, return_ard = FALSE)
Body System or Organ Class
    FMQ (Narrow)
A: Drug X
N = 1341
B: Placebo
N = 1341
C: Combination
N = 1321
Number of patients with event 83 (62%) 90 (67%) 88 (67%)
cl A.1 53 (40%) 55 (41%) 69 (52%)
    FMQ1 22 (16%) 21 (16%) 37 (28%)
    FMQ2 24 (18%) 31 (23%) 33 (25%)
    FMQ3 28 (21%) 25 (19%) 31 (23%)
cl B.1 35 (26%) 41 (31%) 36 (27%)
    FMQ1 12 (9.0%) 17 (13%) 19 (14%)
    FMQ2 9 (6.7%) 21 (16%) 20 (15%)
    FMQ3 19 (14%) 11 (8.2%) 7 (5.3%)
cl B.2 36 (27%) 33 (25%) 35 (27%)
    FMQ1 16 (12%) 15 (11%) 12 (9.1%)
    FMQ2 17 (13%) 12 (9.0%) 16 (12%)
    FMQ3 11 (8.2%) 13 (9.7%) 15 (11%)
cl C.2 26 (19%) 39 (29%) 43 (33%)
    FMQ1 11 (8.2%) 12 (9.0%) 19 (14%)
    FMQ2 11 (8.2%) 15 (11%) 14 (11%)
    FMQ3 8 (6.0%) 14 (10%) 14 (11%)
cl D.1 51 (38%) 51 (38%) 60 (45%)
    FMQ1 22 (16%) 22 (16%) 32 (24%)
    FMQ2 24 (18%) 25 (19%) 33 (25%)
    FMQ3 19 (14%) 24 (18%) 26 (20%)
cl D.2 35 (26%) 46 (34%) 44 (33%)
    FMQ1 11 (8.2%) 23 (17%) 17 (13%)
    FMQ2 18 (13%) 16 (12%) 18 (14%)
    FMQ3 11 (8.2%) 16 (12%) 15 (11%)
1 n (%)
Function Details

make_table_11()


Required variables:

  • df: USUBJID, AEBODSYS, AESER, DCSREAS, and the variables specified by arm_var, saffl_var, fmqsc_var, and fmqnam_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
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"
fmqsc_var (character) FMQ scope variable to use in table. "FMQ01SC"
fmqnam_var (character) FMQ reference name variable to use in table. "FMQ01NAM"
fmq_scope (character) FMQ scope, can be ‘“NARROW”’ or ‘“BROAD”’. "NARROW"
na_level (character) String to represent missing values. "<Missing>"
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

# Pre-Processing - Ensure required variables fmqsc_var and fmqnam_var exist in adae
set.seed(1)
adae <- adae |>
  dplyr::rename(FMQ01SC = SMQ01SC) |>
  dplyr::mutate(
    AESER = sample(c("Y", "N"), size = nrow(adae), replace = TRUE),
    FMQ01NAM = sample(c("FMQ1", "FMQ2", "FMQ3"), size = nrow(adae), replace = TRUE)
  )
adae$DCSREAS[is.na(adae$DCSREAS)] <- "ADVERSE EVENT"
adae$FMQ01SC[is.na(adae$FMQ01SC)] <- "NARROW"

# Create Table & ARD
result <- make_table_11(df = adae, denominator = adsl)

# Output ARD
result$ard
{cards} data frame: 162 x 13
    group1 group1_level   group2 group2_level variable variable_level   context stat_name stat_label  stat fmt_fn warning error
1      ARM    A: Drug X AEBODSYS       cl A.1 FMQ01NAM           FMQ1 hierarch…         n          n    29      0              
2      ARM    A: Drug X AEBODSYS       cl A.1 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
3      ARM    A: Drug X AEBODSYS       cl A.1 FMQ01NAM           FMQ1 hierarch…         p          % 0.216   <fn>              
4      ARM    A: Drug X AEBODSYS       cl A.1 FMQ01NAM           FMQ2 hierarch…         n          n    31      0              
5      ARM    A: Drug X AEBODSYS       cl A.1 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
6      ARM    A: Drug X AEBODSYS       cl A.1 FMQ01NAM           FMQ2 hierarch…         p          % 0.231   <fn>              
7      ARM    A: Drug X AEBODSYS       cl A.1 FMQ01NAM           FMQ3 hierarch…         n          n    36      0              
8      ARM    A: Drug X AEBODSYS       cl A.1 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
9      ARM    A: Drug X AEBODSYS       cl A.1 FMQ01NAM           FMQ3 hierarch…         p          % 0.269   <fn>              
10     ARM    A: Drug X AEBODSYS       cl B.1 FMQ01NAM           FMQ1 hierarch…         n          n    13      0              
11     ARM    A: Drug X AEBODSYS       cl B.1 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
12     ARM    A: Drug X AEBODSYS       cl B.1 FMQ01NAM           FMQ1 hierarch…         p          % 0.097   <fn>              
13     ARM    A: Drug X AEBODSYS       cl B.1 FMQ01NAM           FMQ2 hierarch…         n          n    10      0              
14     ARM    A: Drug X AEBODSYS       cl B.1 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
15     ARM    A: Drug X AEBODSYS       cl B.1 FMQ01NAM           FMQ2 hierarch…         p          % 0.075   <fn>              
16     ARM    A: Drug X AEBODSYS       cl B.1 FMQ01NAM           FMQ3 hierarch…         n          n    19      0              
17     ARM    A: Drug X AEBODSYS       cl B.1 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
18     ARM    A: Drug X AEBODSYS       cl B.1 FMQ01NAM           FMQ3 hierarch…         p          % 0.142   <fn>              
19     ARM    A: Drug X AEBODSYS       cl B.2 FMQ01NAM           FMQ1 hierarch…         n          n    19      0              
20     ARM    A: Drug X AEBODSYS       cl B.2 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
21     ARM    A: Drug X AEBODSYS       cl B.2 FMQ01NAM           FMQ1 hierarch…         p          % 0.142   <fn>              
22     ARM    A: Drug X AEBODSYS       cl B.2 FMQ01NAM           FMQ2 hierarch…         n          n    18      0              
23     ARM    A: Drug X AEBODSYS       cl B.2 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
24     ARM    A: Drug X AEBODSYS       cl B.2 FMQ01NAM           FMQ2 hierarch…         p          % 0.134   <fn>              
25     ARM    A: Drug X AEBODSYS       cl B.2 FMQ01NAM           FMQ3 hierarch…         n          n    11      0              
26     ARM    A: Drug X AEBODSYS       cl B.2 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
27     ARM    A: Drug X AEBODSYS       cl B.2 FMQ01NAM           FMQ3 hierarch…         p          % 0.082   <fn>              
28     ARM    A: Drug X AEBODSYS       cl C.2 FMQ01NAM           FMQ1 hierarch…         n          n    14      0              
29     ARM    A: Drug X AEBODSYS       cl C.2 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
30     ARM    A: Drug X AEBODSYS       cl C.2 FMQ01NAM           FMQ1 hierarch…         p          % 0.104   <fn>              
31     ARM    A: Drug X AEBODSYS       cl C.2 FMQ01NAM           FMQ2 hierarch…         n          n    11      0              
32     ARM    A: Drug X AEBODSYS       cl C.2 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
33     ARM    A: Drug X AEBODSYS       cl C.2 FMQ01NAM           FMQ2 hierarch…         p          % 0.082   <fn>              
34     ARM    A: Drug X AEBODSYS       cl C.2 FMQ01NAM           FMQ3 hierarch…         n          n    10      0              
35     ARM    A: Drug X AEBODSYS       cl C.2 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
36     ARM    A: Drug X AEBODSYS       cl C.2 FMQ01NAM           FMQ3 hierarch…         p          % 0.075   <fn>              
37     ARM    A: Drug X AEBODSYS       cl D.1 FMQ01NAM           FMQ1 hierarch…         n          n    26      0              
38     ARM    A: Drug X AEBODSYS       cl D.1 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
39     ARM    A: Drug X AEBODSYS       cl D.1 FMQ01NAM           FMQ1 hierarch…         p          % 0.194   <fn>              
40     ARM    A: Drug X AEBODSYS       cl D.1 FMQ01NAM           FMQ2 hierarch…         n          n    32      0              
41     ARM    A: Drug X AEBODSYS       cl D.1 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
42     ARM    A: Drug X AEBODSYS       cl D.1 FMQ01NAM           FMQ2 hierarch…         p          % 0.239   <fn>              
43     ARM    A: Drug X AEBODSYS       cl D.1 FMQ01NAM           FMQ3 hierarch…         n          n    19      0              
44     ARM    A: Drug X AEBODSYS       cl D.1 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
45     ARM    A: Drug X AEBODSYS       cl D.1 FMQ01NAM           FMQ3 hierarch…         p          % 0.142   <fn>              
46     ARM    A: Drug X AEBODSYS       cl D.2 FMQ01NAM           FMQ1 hierarch…         n          n    12      0              
47     ARM    A: Drug X AEBODSYS       cl D.2 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
48     ARM    A: Drug X AEBODSYS       cl D.2 FMQ01NAM           FMQ1 hierarch…         p          %  0.09   <fn>              
49     ARM    A: Drug X AEBODSYS       cl D.2 FMQ01NAM           FMQ2 hierarch…         n          n    20      0              
50     ARM    A: Drug X AEBODSYS       cl D.2 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
51     ARM    A: Drug X AEBODSYS       cl D.2 FMQ01NAM           FMQ2 hierarch…         p          % 0.149   <fn>              
52     ARM    A: Drug X AEBODSYS       cl D.2 FMQ01NAM           FMQ3 hierarch…         n          n    12      0              
53     ARM    A: Drug X AEBODSYS       cl D.2 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
54     ARM    A: Drug X AEBODSYS       cl D.2 FMQ01NAM           FMQ3 hierarch…         p          %  0.09   <fn>              
55     ARM    B: Place… AEBODSYS       cl A.1 FMQ01NAM           FMQ1 hierarch…         n          n    28      0              
56     ARM    B: Place… AEBODSYS       cl A.1 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
57     ARM    B: Place… AEBODSYS       cl A.1 FMQ01NAM           FMQ1 hierarch…         p          % 0.209   <fn>              
58     ARM    B: Place… AEBODSYS       cl A.1 FMQ01NAM           FMQ2 hierarch…         n          n    36      0              
59     ARM    B: Place… AEBODSYS       cl A.1 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
60     ARM    B: Place… AEBODSYS       cl A.1 FMQ01NAM           FMQ2 hierarch…         p          % 0.269   <fn>              
61     ARM    B: Place… AEBODSYS       cl A.1 FMQ01NAM           FMQ3 hierarch…         n          n    28      0              
62     ARM    B: Place… AEBODSYS       cl A.1 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
63     ARM    B: Place… AEBODSYS       cl A.1 FMQ01NAM           FMQ3 hierarch…         p          % 0.209   <fn>              
64     ARM    B: Place… AEBODSYS       cl B.1 FMQ01NAM           FMQ1 hierarch…         n          n    17      0              
65     ARM    B: Place… AEBODSYS       cl B.1 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
66     ARM    B: Place… AEBODSYS       cl B.1 FMQ01NAM           FMQ1 hierarch…         p          % 0.127   <fn>              
67     ARM    B: Place… AEBODSYS       cl B.1 FMQ01NAM           FMQ2 hierarch…         n          n    23      0              
68     ARM    B: Place… AEBODSYS       cl B.1 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
69     ARM    B: Place… AEBODSYS       cl B.1 FMQ01NAM           FMQ2 hierarch…         p          % 0.172   <fn>              
70     ARM    B: Place… AEBODSYS       cl B.1 FMQ01NAM           FMQ3 hierarch…         n          n    11      0              
71     ARM    B: Place… AEBODSYS       cl B.1 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
72     ARM    B: Place… AEBODSYS       cl B.1 FMQ01NAM           FMQ3 hierarch…         p          % 0.082   <fn>              
73     ARM    B: Place… AEBODSYS       cl B.2 FMQ01NAM           FMQ1 hierarch…         n          n    18      0              
74     ARM    B: Place… AEBODSYS       cl B.2 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
75     ARM    B: Place… AEBODSYS       cl B.2 FMQ01NAM           FMQ1 hierarch…         p          % 0.134   <fn>              
76     ARM    B: Place… AEBODSYS       cl B.2 FMQ01NAM           FMQ2 hierarch…         n          n    12      0              
77     ARM    B: Place… AEBODSYS       cl B.2 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
78     ARM    B: Place… AEBODSYS       cl B.2 FMQ01NAM           FMQ2 hierarch…         p          %  0.09   <fn>              
79     ARM    B: Place… AEBODSYS       cl B.2 FMQ01NAM           FMQ3 hierarch…         n          n    14      0              
80     ARM    B: Place… AEBODSYS       cl B.2 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
81     ARM    B: Place… AEBODSYS       cl B.2 FMQ01NAM           FMQ3 hierarch…         p          % 0.104   <fn>              
82     ARM    B: Place… AEBODSYS       cl C.2 FMQ01NAM           FMQ1 hierarch…         n          n    12      0              
83     ARM    B: Place… AEBODSYS       cl C.2 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
84     ARM    B: Place… AEBODSYS       cl C.2 FMQ01NAM           FMQ1 hierarch…         p          %  0.09   <fn>              
85     ARM    B: Place… AEBODSYS       cl C.2 FMQ01NAM           FMQ2 hierarch…         n          n    17      0              
86     ARM    B: Place… AEBODSYS       cl C.2 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
87     ARM    B: Place… AEBODSYS       cl C.2 FMQ01NAM           FMQ2 hierarch…         p          % 0.127   <fn>              
88     ARM    B: Place… AEBODSYS       cl C.2 FMQ01NAM           FMQ3 hierarch…         n          n    14      0              
89     ARM    B: Place… AEBODSYS       cl C.2 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
90     ARM    B: Place… AEBODSYS       cl C.2 FMQ01NAM           FMQ3 hierarch…         p          % 0.104   <fn>              
91     ARM    B: Place… AEBODSYS       cl D.1 FMQ01NAM           FMQ1 hierarch…         n          n    26      0              
92     ARM    B: Place… AEBODSYS       cl D.1 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
93     ARM    B: Place… AEBODSYS       cl D.1 FMQ01NAM           FMQ1 hierarch…         p          % 0.194   <fn>              
94     ARM    B: Place… AEBODSYS       cl D.1 FMQ01NAM           FMQ2 hierarch…         n          n    28      0              
95     ARM    B: Place… AEBODSYS       cl D.1 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
96     ARM    B: Place… AEBODSYS       cl D.1 FMQ01NAM           FMQ2 hierarch…         p          % 0.209   <fn>              
97     ARM    B: Place… AEBODSYS       cl D.1 FMQ01NAM           FMQ3 hierarch…         n          n    32      0              
98     ARM    B: Place… AEBODSYS       cl D.1 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
99     ARM    B: Place… AEBODSYS       cl D.1 FMQ01NAM           FMQ3 hierarch…         p          % 0.239   <fn>              
100    ARM    B: Place… AEBODSYS       cl D.2 FMQ01NAM           FMQ1 hierarch…         n          n    24      0              
101    ARM    B: Place… AEBODSYS       cl D.2 FMQ01NAM           FMQ1 hierarch…         N          N   134      0              
102    ARM    B: Place… AEBODSYS       cl D.2 FMQ01NAM           FMQ1 hierarch…         p          % 0.179   <fn>              
103    ARM    B: Place… AEBODSYS       cl D.2 FMQ01NAM           FMQ2 hierarch…         n          n    18      0              
104    ARM    B: Place… AEBODSYS       cl D.2 FMQ01NAM           FMQ2 hierarch…         N          N   134      0              
105    ARM    B: Place… AEBODSYS       cl D.2 FMQ01NAM           FMQ2 hierarch…         p          % 0.134   <fn>              
106    ARM    B: Place… AEBODSYS       cl D.2 FMQ01NAM           FMQ3 hierarch…         n          n    16      0              
107    ARM    B: Place… AEBODSYS       cl D.2 FMQ01NAM           FMQ3 hierarch…         N          N   134      0              
108    ARM    B: Place… AEBODSYS       cl D.2 FMQ01NAM           FMQ3 hierarch…         p          % 0.119   <fn>              
109    ARM    C: Combi… AEBODSYS       cl A.1 FMQ01NAM           FMQ1 hierarch…         n          n    46      0              
110    ARM    C: Combi… AEBODSYS       cl A.1 FMQ01NAM           FMQ1 hierarch…         N          N   132      0              
111    ARM    C: Combi… AEBODSYS       cl A.1 FMQ01NAM           FMQ1 hierarch…         p          % 0.348   <fn>              
112    ARM    C: Combi… AEBODSYS       cl A.1 FMQ01NAM           FMQ2 hierarch…         n          n    41      0              
113    ARM    C: Combi… AEBODSYS       cl A.1 FMQ01NAM           FMQ2 hierarch…         N          N   132      0              
114    ARM    C: Combi… AEBODSYS       cl A.1 FMQ01NAM           FMQ2 hierarch…         p          % 0.311   <fn>              
115    ARM    C: Combi… AEBODSYS       cl A.1 FMQ01NAM           FMQ3 hierarch…         n          n    42      0              
116    ARM    C: Combi… AEBODSYS       cl A.1 FMQ01NAM           FMQ3 hierarch…         N          N   132      0              
117    ARM    C: Combi… AEBODSYS       cl A.1 FMQ01NAM           FMQ3 hierarch…         p          % 0.318   <fn>              
118    ARM    C: Combi… AEBODSYS       cl B.1 FMQ01NAM           FMQ1 hierarch…         n          n    19      0              
119    ARM    C: Combi… AEBODSYS       cl B.1 FMQ01NAM           FMQ1 hierarch…         N          N   132      0              
120    ARM    C: Combi… AEBODSYS       cl B.1 FMQ01NAM           FMQ1 hierarch…         p          % 0.144   <fn>              
121    ARM    C: Combi… AEBODSYS       cl B.1 FMQ01NAM           FMQ2 hierarch…         n          n    26      0              
122    ARM    C: Combi… AEBODSYS       cl B.1 FMQ01NAM           FMQ2 hierarch…         N          N   132      0              
123    ARM    C: Combi… AEBODSYS       cl B.1 FMQ01NAM           FMQ2 hierarch…         p          % 0.197   <fn>              
124    ARM    C: Combi… AEBODSYS       cl B.1 FMQ01NAM           FMQ3 hierarch…         n          n     7      0              
125    ARM    C: Combi… AEBODSYS       cl B.1 FMQ01NAM           FMQ3 hierarch…         N          N   132      0              
126    ARM    C: Combi… AEBODSYS       cl B.1 FMQ01NAM           FMQ3 hierarch…         p          % 0.053   <fn>              
127    ARM    C: Combi… AEBODSYS       cl B.2 FMQ01NAM           FMQ1 hierarch…         n          n    13      0              
128    ARM    C: Combi… AEBODSYS       cl B.2 FMQ01NAM           FMQ1 hierarch…         N          N   132      0              
129    ARM    C: Combi… AEBODSYS       cl B.2 FMQ01NAM           FMQ1 hierarch…         p          % 0.098   <fn>              
130    ARM    C: Combi… AEBODSYS       cl B.2 FMQ01NAM           FMQ2 hierarch…         n          n    16      0              
131    ARM    C: Combi… AEBODSYS       cl B.2 FMQ01NAM           FMQ2 hierarch…         N          N   132      0              
132    ARM    C: Combi… AEBODSYS       cl B.2 FMQ01NAM           FMQ2 hierarch…         p          % 0.121   <fn>              
133    ARM    C: Combi… AEBODSYS       cl B.2 FMQ01NAM           FMQ3 hierarch…         n          n    15      0              
134    ARM    C: Combi… AEBODSYS       cl B.2 FMQ01NAM           FMQ3 hierarch…         N          N   132      0              
135    ARM    C: Combi… AEBODSYS       cl B.2 FMQ01NAM           FMQ3 hierarch…         p          % 0.114   <fn>              
136    ARM    C: Combi… AEBODSYS       cl C.2 FMQ01NAM           FMQ1 hierarch…         n          n    20      0              
137    ARM    C: Combi… AEBODSYS       cl C.2 FMQ01NAM           FMQ1 hierarch…         N          N   132      0              
138    ARM    C: Combi… AEBODSYS       cl C.2 FMQ01NAM           FMQ1 hierarch…         p          % 0.152   <fn>              
139    ARM    C: Combi… AEBODSYS       cl C.2 FMQ01NAM           FMQ2 hierarch…         n          n    15      0              
140    ARM    C: Combi… AEBODSYS       cl C.2 FMQ01NAM           FMQ2 hierarch…         N          N   132      0              
141    ARM    C: Combi… AEBODSYS       cl C.2 FMQ01NAM           FMQ2 hierarch…         p          % 0.114   <fn>              
142    ARM    C: Combi… AEBODSYS       cl C.2 FMQ01NAM           FMQ3 hierarch…         n          n    14      0              
143    ARM    C: Combi… AEBODSYS       cl C.2 FMQ01NAM           FMQ3 hierarch…         N          N   132      0              
144    ARM    C: Combi… AEBODSYS       cl C.2 FMQ01NAM           FMQ3 hierarch…         p          % 0.106   <fn>              
145    ARM    C: Combi… AEBODSYS       cl D.1 FMQ01NAM           FMQ1 hierarch…         n          n    35      0              
146    ARM    C: Combi… AEBODSYS       cl D.1 FMQ01NAM           FMQ1 hierarch…         N          N   132      0              
147    ARM    C: Combi… AEBODSYS       cl D.1 FMQ01NAM           FMQ1 hierarch…         p          % 0.265   <fn>              
148    ARM    C: Combi… AEBODSYS       cl D.1 FMQ01NAM           FMQ2 hierarch…         n          n    41      0              
149    ARM    C: Combi… AEBODSYS       cl D.1 FMQ01NAM           FMQ2 hierarch…         N          N   132      0              
150    ARM    C: Combi… AEBODSYS       cl D.1 FMQ01NAM           FMQ2 hierarch…         p          % 0.311   <fn>              
151    ARM    C: Combi… AEBODSYS       cl D.1 FMQ01NAM           FMQ3 hierarch…         n          n    27      0              
152    ARM    C: Combi… AEBODSYS       cl D.1 FMQ01NAM           FMQ3 hierarch…         N          N   132      0              
153    ARM    C: Combi… AEBODSYS       cl D.1 FMQ01NAM           FMQ3 hierarch…         p          % 0.205   <fn>              
154    ARM    C: Combi… AEBODSYS       cl D.2 FMQ01NAM           FMQ1 hierarch…         n          n    18      0              
155    ARM    C: Combi… AEBODSYS       cl D.2 FMQ01NAM           FMQ1 hierarch…         N          N   132      0              
156    ARM    C: Combi… AEBODSYS       cl D.2 FMQ01NAM           FMQ1 hierarch…         p          % 0.136   <fn>              
157    ARM    C: Combi… AEBODSYS       cl D.2 FMQ01NAM           FMQ2 hierarch…         n          n    19      0              
158    ARM    C: Combi… AEBODSYS       cl D.2 FMQ01NAM           FMQ2 hierarch…         N          N   132      0              
159    ARM    C: Combi… AEBODSYS       cl D.2 FMQ01NAM           FMQ2 hierarch…         p          % 0.144   <fn>              
160    ARM    C: Combi… AEBODSYS       cl D.2 FMQ01NAM           FMQ3 hierarch…         n          n    18      0              
161    ARM    C: Combi… AEBODSYS       cl D.2 FMQ01NAM           FMQ3 hierarch…         N          N   132      0              
162    ARM    C: Combi… AEBODSYS       cl D.2 FMQ01NAM           FMQ3 hierarch…         p          % 0.136   <fn>              
rtables Table Setup
# Load Libraries & Data
library(cardinal)

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

# Pre-Processing - Ensure required variables fmqsc_var and fmqnam_var exist in adae
set.seed(1)
adae <- adae |>
  dplyr::rename(FMQ01SC = SMQ01SC) |>
  dplyr::mutate(
    AESER = sample(c("Y", "N"), size = nrow(adae), replace = TRUE),
    FMQ01NAM = sample(c("FMQ1", "FMQ2", "FMQ3"), size = nrow(adae), replace = TRUE)
  )
adae$DCSREAS[is.na(adae$DCSREAS)] <- "ADVERSE EVENT"
adae$FMQ01SC[is.na(adae$FMQ01SC)] <- "NARROW"

# Output Table
risk_diff <- list(arm_x = "B: Placebo", arm_y = "A: Drug X") # optional
make_table_11_rtables(df = adae, alt_counts_df = adsl, risk_diff = risk_diff)
Body System or Organ Class                                 A: Drug X    B: Placebo   C: Combination   Risk Difference (%) (95% CI)
  FMQ (Narrow)                                              (N=134)      (N=134)        (N=132)                 (N=268)           
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Patients with at least one AE leading to discontinuation   83 (61.9%)   90 (67.2%)     88 (66.7%)          5.2 (-6.2 - 16.7)      
cl A.1                                                     53 (39.6%)   55 (41.0%)     69 (52.3%)          1.5 (-10.3 - 13.2)     
  FMQ1                                                     22 (16.4%)   21 (15.7%)     37 (28.0%)          -0.7 (-9.5 - 8.0)      
  FMQ2                                                     24 (17.9%)   31 (23.1%)     33 (25.0%)          5.2 (-4.4 - 14.9)      
  FMQ3                                                     28 (20.9%)   25 (18.7%)     31 (23.5%)          -2.2 (-11.8 - 7.3)     
cl B.1                                                     35 (26.1%)   41 (30.6%)     36 (27.3%)          4.5 (-6.3 - 15.3)      
  FMQ1                                                     12 (9.0%)    17 (12.7%)     19 (14.4%)          3.7 (-3.7 - 11.2)      
  FMQ2                                                      9 (6.7%)    21 (15.7%)     20 (15.2%)           9.0 (1.5 - 16.4)      
  FMQ3                                                     19 (14.2%)   11 (8.2%)       7 (5.3%)           -6.0 (-13.5 - 1.5)     
cl B.2                                                     36 (26.9%)   33 (24.6%)     35 (26.5%)          -2.2 (-12.7 - 8.2)     
  FMQ1                                                     16 (11.9%)   15 (11.2%)     12 (9.1%)           -0.7 (-8.4 - 6.9)      
  FMQ2                                                     17 (12.7%)   12 (9.0%)      16 (12.1%)          -3.7 (-11.2 - 3.7)     
  FMQ3                                                     11 (8.2%)    13 (9.7%)      15 (11.4%)           1.5 (-5.3 - 8.3)      
cl C.2                                                     26 (19.4%)   39 (29.1%)     43 (32.6%)          9.7 (-0.5 - 19.9)      
  FMQ1                                                     11 (8.2%)    12 (9.0%)      19 (14.4%)           0.7 (-6.0 - 7.5)      
  FMQ2                                                     11 (8.2%)    15 (11.2%)     14 (10.6%)          3.0 (-4.1 - 10.1)      
  FMQ3                                                      8 (6.0%)    14 (10.4%)     14 (10.6%)          4.5 (-2.1 - 11.0)      
cl D.1                                                     51 (38.1%)   51 (38.1%)     60 (45.5%)          0.0 (-11.6 - 11.6)     
  FMQ1                                                     22 (16.4%)   22 (16.4%)     32 (24.2%)           0.0 (-8.9 - 8.9)      
  FMQ2                                                     24 (17.9%)   25 (18.7%)     33 (25.0%)          0.7 (-8.5 - 10.0)      
  FMQ3                                                     19 (14.2%)   24 (17.9%)     26 (19.7%)          3.7 (-5.0 - 12.5)      
cl D.2                                                     35 (26.1%)   46 (34.3%)     44 (33.3%)          8.2 (-2.7 - 19.2)      
  FMQ1                                                     11 (8.2%)    23 (17.2%)     17 (12.9%)           9.0 (1.1 - 16.9)      
  FMQ2                                                     18 (13.4%)   16 (11.9%)     18 (13.6%)          -1.5 (-9.5 - 6.5)      
  FMQ3                                                     11 (8.2%)    16 (11.9%)     15 (11.4%)          3.7 (-3.5 - 10.9)      
Function Details

make_table_11_rtables()


Required variables:

  • df: USUBJID, AEBODSYS, AESER, DCSREAS, and the variables specified by arm_var, saffl_var, fmqsc_var, and fmqnam_var.
  • alt_counts_df (if specified): USUBJID and the variables specified by arm_var and saffl_var.
Argument Description Default
adae (data.frame) Dataset (typically ADAE) required to build table. No default
alt_counts_df (character) Alternative dataset used only to calculate column counts. NULL
show_colcounts (flag) Whether column counts should be printed. TRUE
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"
fmqsc_var (character) FMQ scope variable to use in table. "FMQ01SC"
fmqnam_var (character) FMQ reference name variable to use in table. "FMQ01NAM"
fmq_scope (character) FMQ scope, can be ‘“NARROW”’ or ‘“BROAD”’. "NARROW"
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
na_level (character) String to represent missing values. "<Missing>"
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 11
subtitle: Patients with FDA Medical Query (Narrow) Leading to Treatment Discontinuation, Safety Population, Pooled Analyses
---

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

::: panel-tabset
## Spec. Screenshot

![](../assets/images/screenshots/table_11.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
adae <- random.cdisc.data::cadae

# Pre-Processing - Ensure required variables fmqsc_var and fmqnam_var exist in adae
set.seed(1)
adae <- adae |>
  dplyr::rename(FMQ01SC = SMQ01SC) |>
  dplyr::mutate(
    AESER = sample(c("Y", "N"), size = nrow(adae), replace = TRUE),
    FMQ01NAM = sample(c("FMQ1", "FMQ2", "FMQ3"), size = nrow(adae), replace = TRUE)
  )
adae$DCSREAS[is.na(adae$DCSREAS)] <- "ADVERSE EVENT"
adae$FMQ01SC[is.na(adae$FMQ01SC)] <- "NARROW"

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

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

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

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

Required variables:

-   **`df`**: `USUBJID`, `AEBODSYS`, `AESER`, `DCSREAS`, and the variables specified by `arm_var`, `saffl_var`, `fmqsc_var`, and `fmqnam_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`        |
| `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"`     |
| `fmqsc_var`     | (`character`) FMQ scope variable to use in table.                                                        | `"FMQ01SC"`   |
| `fmqnam_var`    | (`character`) FMQ reference name variable to use in table.                                               | `"FMQ01NAM"`  |
| `fmq_scope`     | (`character`) FMQ scope, can be '"NARROW"' or '"BROAD"'.                                                 | `"NARROW"`    |
| `na_level`      | (`character`) String to represent missing values.                                                        | `"<Missing>"` |

Source code for this function is available [here](https://github.com/pharmaverse/cardinal/blob/main/R/fda-table_11.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
adae <- random.cdisc.data::cadae

# Pre-Processing - Ensure required variables fmqsc_var and fmqnam_var exist in adae
set.seed(1)
adae <- adae |>
  dplyr::rename(FMQ01SC = SMQ01SC) |>
  dplyr::mutate(
    AESER = sample(c("Y", "N"), size = nrow(adae), replace = TRUE),
    FMQ01NAM = sample(c("FMQ1", "FMQ2", "FMQ3"), size = nrow(adae), replace = TRUE)
  )
adae$DCSREAS[is.na(adae$DCSREAS)] <- "ADVERSE EVENT"
adae$FMQ01SC[is.na(adae$FMQ01SC)] <- "NARROW"

# Create Table & ARD
result <- make_table_11(df = adae, denominator = adsl)

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

```{r tbl1-print, echo=FALSE}
withr::local_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
adae <- random.cdisc.data::cadae

# Pre-Processing - Ensure required variables fmqsc_var and fmqnam_var exist in adae
set.seed(1)
adae <- adae |>
  dplyr::rename(FMQ01SC = SMQ01SC) |>
  dplyr::mutate(
    AESER = sample(c("Y", "N"), size = nrow(adae), replace = TRUE),
    FMQ01NAM = sample(c("FMQ1", "FMQ2", "FMQ3"), size = nrow(adae), replace = TRUE)
  )
adae$DCSREAS[is.na(adae$DCSREAS)] <- "ADVERSE EVENT"
adae$FMQ01SC[is.na(adae$FMQ01SC)] <- "NARROW"

# Output Table
risk_diff <- list(arm_x = "B: Placebo", arm_y = "A: Drug X") # optional
make_table_11_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_11_rtables()`

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

Required variables:

-   **`df`**: `USUBJID`, `AEBODSYS`, `AESER`, `DCSREAS`, and the variables specified by `arm_var`, `saffl_var`, `fmqsc_var`, and `fmqnam_var`.
-   **`alt_counts_df`** (if specified): `USUBJID` and the variables specified by `arm_var` and `saffl_var`.

+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| **Argument**     | **Description**                                                                                                                                                                                                                                                | **Default**   |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| `adae`           | (`data.frame`) Dataset (typically ADAE) required to build table.                                                                                                                                                                                               | *No default*  |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| `alt_counts_df`  | (`character`) Alternative dataset used only to calculate column counts.                                                                                                                                                                                        | `NULL`        |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| `show_colcounts` | (`flag`) Whether column counts should be printed.                                                                                                                                                                                                              | `TRUE`        |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| `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"`     |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| `fmqsc_var`      | (`character`) FMQ scope variable to use in table.                                                                                                                                                                                                              | `"FMQ01SC"`   |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| `fmqnam_var`     | (`character`) FMQ reference name variable to use in table.                                                                                                                                                                                                     | `"FMQ01NAM"`  |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| `fmq_scope`      | (`character`) FMQ scope, can be '"NARROW"' or '"BROAD"'.                                                                                                                                                                                                       | `"NARROW"`    |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| `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`       |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| `na_level`       | (`character`) String to represent missing values.                                                                                                                                                                                                              | `"<Missing>"` |
+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| `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_11.R).
</details>

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