Creates baseline prevalence and post-baseline incidence sections for ADA/NAb data. For multi-arm data, original treatment columns are retained, optional custom pooled columns are added, and a Total column is always added.

tbl_ada_summary(
  data,
  by = NULL,
  pools = NULL,
  total_label = "All Patients",
  keep_original = TRUE,
  null_postbaseline = NULL,
  baseline_header = "Baseline Prevalence of NAbs",
  postbaseline_header = "Incidence of NAbs",
  baseline_label = list(ADABLPFL = "Baseline evaluable patients for ADA", adaposbl =
    "Patients with a positive ADA sample at baseline", nabevalbase =
    "Baseline evaluable patients for NAb", nabposbl =
    "Patients with a positive NAb sample at baseline", nabnegbl =
    "Patients with no positive NAb sample at baseline"),
  postbaseline_label = list(ADPBLPFL = "Post-baseline evaluable patients for ADA",
    adastatpos = "Patients positive for ADA", nabpbeval =
    "Post-baseline evaluable patients for NAb", nabstatpos = "Patients positive for NAb",
    nabstatneg = "Patients negative for NAb"),
  add_blank_row = FALSE
)

Arguments

data

(data.frame)
A data frame containing ADAT variables.

by

(string or NULL)
A single treatment/grouping variable, or NULL for an unstratified table.

pools

(list or NULL)
An optional named list of custom pooled columns passed to tbl_with_pools(). For example, list("Xanomeline Dosed" = c("High Dose", "Low Dose")).

total_label

(string)
Display label for the Total column.

keep_original

(logical)
Whether original treatment columns are retained when calculated columns are added.

null_postbaseline

(character or NULL)
Character vector of displayed column labels to blank in the post-baseline section. This can include original treatment columns, custom pooled columns, and the Total column. Use NULL to retain all post-baseline values.

baseline_header

(string)
Header for the baseline section.

postbaseline_header

(string)
Header for the post-baseline section.

baseline_label

(list or NULL)
Optional named list of baseline variable labels.

postbaseline_label

(list or NULL)
Optional named list of post-baseline variable labels.

add_blank_row

(logical)
Whether to insert a blank row between the baseline and post-baseline sections. Default is FALSE.

Value

A tbl_ada_summary and gtsummary object.

Examples

# Minimal ADAT-like dataset with three arms
df <- data.frame(
  USUBJID = paste0("S", 1:15),
  TRT = rep(c("Drug A", "Drug B", "Placebo"), each = 5),
  ADABLPFL = c(rep("Y", 13), "N", "N"),
  adaposbl = c(rep("Y", 4), rep("N", 11)),
  nabevalbase = c(rep("Y", 14), "N"),
  nabposbl = c(rep("Y", 3), rep("N", 12)),
  nabnegbl = c(rep("N", 3), rep("Y", 12)),
  ADPBLPFL = c(rep("Y", 13), "N", "N"),
  adastatpos = c(rep("Y", 4), rep("N", 11)),
  nabpbeval = c(rep("Y", 14), "N"),
  nabstatpos = c(rep("Y", 3), rep("N", 12)),
  nabstatneg = c(rep("N", 3), rep("Y", 12)),
  stringsAsFactors = FALSE
)

# Pool two active arms; blank post-baseline for Placebo and All Patients
tbl_ada_summary(
  df,
  by = "TRT",
  pools = list("Drug A+B" = c("Drug A", "Drug B")),
  total_label = "All Patients",
  null_postbaseline = c("Placebo", "All Patients")
)
Drug A
(N = 5)
Drug B
(N = 5)
Placebo
(N = 5)
Drug A+B
(N = 10)
All Patients
(N = 15)
Baseline Prevalence of NAbs




    Baseline evaluable patients for ADA




    N 0 0 2
2
    Y 5 5 3 10 13
    Patients with a positive ADA sample at baseline




    N 1 5 5 6 11
    Y 4 0 0 4 4
    Baseline evaluable patients for NAb




    N 0 0 1
1
    Y 5 5 4 10 14
       Patients with a positive NAb sample at baseline




       N 2 (40.0%) 5 (100%) 5 (100%) 7 (70.0%) 12 (80.0%)
       Y 3 (60.0%) 0 0 3 (30.0%) 3 (20.0%)
       Patients with no positive NAb sample at baseline




       N 3 0 0 3 3
       Y 2 5 5 7 12
Incidence of NAbs




    Post-baseline evaluable patients for ADA




    N 0 0


    Y 5 5
10
    Patients positive for ADA




    N 1 5
6
    Y 4 0
4
    Post-baseline evaluable patients for NAb




    N 0 0


    Y 5 5
10
       Patients positive for NAb




       N 2 (40.0%) 5 (100%)
7 (70.0%)
       Y 3 (60.0%) 0
3 (30.0%)
       Patients negative for NAb




       N 3 0
3
       Y 2 5
7
# Unstratified table (no by variable) tbl_ada_summary(df, by = NULL)
Overall
(N = 15)
Baseline Prevalence of NAbs
    Baseline evaluable patients for ADA
    N 2
    Y 13
    Patients with a positive ADA sample at baseline
    N 11
    Y 4
    Baseline evaluable patients for NAb
    N 1
    Y 14
       Patients with a positive NAb sample at baseline
       N 12 (80.0%)
       Y 3 (20.0%)
       Patients with no positive NAb sample at baseline
       N 3
       Y 12
Incidence of NAbs
    Post-baseline evaluable patients for ADA
    N 2
    Y 13
    Patients positive for ADA
    N 11
    Y 4
    Post-baseline evaluable patients for NAb
    N 1
    Y 14
       Patients positive for NAb
       N 12 (80.0%)
       Y 3 (20.0%)
       Patients negative for NAb
       N 3
       Y 12