Typical use is tabulating changes from baseline measurement of an Analysis Variable.

tbl_baseline_chg(
  data,
  baseline_level,
  denominator,
  by = NULL,
  digits = NULL,
  id = "USUBJID",
  visit = "AVISIT",
  visit_number = "AVISITN",
  analysis_variable = "AVAL",
  change_variable = "CHG"
)

# S3 method for class 'tbl_baseline_chg'
add_overall(
  x,
  last = FALSE,
  col_label = "All Participants  \n(N = {gtsummary::style_number(n)})",
  ...
)

Arguments

data

(data.frame)
A data frame.

baseline_level

(string)
String identifying baseline level in the visit variable.

denominator

(string)
Data set used to compute the header counts (typically ADSL).

by

(tidy-select)
A single column from data. Summary statistics will be stratified by this variable. Default is NULL.

digits

(formula-list-selector)
Specifies how summary statistics are rounded. Values may be either integer(s) or function(s). If not specified, default formatting is assigned via assign_summary_digits(). See below for details.

id

(string)
String identifying the unique subjects. Default is 'USUBJID'.

visit

(string)
String for the visit variable. Default is 'AVISIT'. If there are more than one entry for each visit and subject, only the first row is kept.

visit_number

(string)
String identifying the visit or analysis sequence number. Default is 'AVISITN'.

analysis_variable

(string)
String identifying the analysis values. Default is 'AVAL'.

change_variable

(string)
String identifying the change from baseline values. Default is 'CHG'.

x

(tbl_summary, tbl_svysummary, tbl_continuous, tbl_custom_summary)
A stratified 'gtsummary' table

last

(scalar logical)
Logical indicator to display overall column last in table. Default is FALSE, which will display overall column first.

col_label

(string)
String indicating the column label. Default is "**Overall** \nN = {style_number(N)}"

...

These dots are for future extensions and must be empty.

Value

a gtsummary table

Examples

theme_gtsummary_roche()
#> Setting theme "Roche"

df <- cards::ADLB |>
  dplyr::mutate(AVISIT = trimws(AVISIT)) |>
  dplyr::filter(
    AVISIT != "End of Treatment",
    PARAMCD == "SODIUM"
  )

tbl_baseline_chg(
  data = df,
  baseline_level = "Baseline",
  by = "TRTA",
  denominator = cards::ADSL
)
#>  Converting column "TRTA" to a factor.
Visit
Placebo
(N = 86)
Xanomeline High Dose
(N = 84)
Xanomeline Low Dose
(N = 84)
Value at Visit Change from Baseline Value at Visit Change from Baseline Value at Visit Change from Baseline
Baseline





    n 7
7
6
    Mean (SD) 141.14 (1.46)
139.14 (2.19)
139.50 (4.23)
    Median 141.00
139.00
138.50
    Min - Max 140.00 - 144.00
136.00 - 142.00
134.00 - 145.00
Week 2





    n 7 7 6 6 6 6
    Mean (SD) 140.57 (1.62) -0.6 (1.9) 138.83 (3.25) 0.2 (3.5) 139.50 (2.35) 0.0 (3.7)
    Median 141.00 -1.0 140.50 0.5 139.50 -0.5
    Min - Max 138.00 - 142.00 -3.0 - 2.0 133.00 - 141.00 -5.0 - 5.0 136.00 - 142.00 -5.0 - 5.0
Week 4





    n 7 7 6 6 5 5
    Mean (SD) 139.29 (2.81) -1.86 (2.54) 139.83 (3.54) 1.17 (2.04) 139.40 (1.34) -0.60 (3.51)
    Median 140.00 -1.00 138.50 0.00 140.00 0.00
    Min - Max 134.00 - 142.00 -7.00 - 0.00 138.00 - 147.00 0.00 - 5.00 138.00 - 141.00 -5.00 - 4.00
Week 6





    n 5 5 6 6 4 4
    Mean (SD) 140.00 (1.87) -0.40 (1.67) 139.67 (1.97) 1.00 (2.28) 140.50 (2.65) 1.75 (5.38)
    Median 140.00 0.00 139.00 0.50 140.00 2.50
    Min - Max 138.00 - 143.00 -2.00 - 2.00 138.00 - 143.00 -1.00 - 5.00 138.00 - 144.00 -5.00 - 7.00
Week 8





    n 5 5 4 4 3 3
    Mean (SD) 140.60 (1.52) 0.20 (1.64) 139.00 (2.16) -0.50 (2.38) 139.00 (2.65) 0.00 (3.46)
    Median 141.00 1.00 139.50 -0.50 140.00 2.00
    Min - Max 139.00 - 142.00 -2.00 - 2.00 136.00 - 141.00 -3.00 - 2.00 136.00 - 141.00 -4.00 - 2.00
Week 12





    n 5 5 4 4 2 2
    Mean (SD) 141.00 (1.58) 0.60 (1.14) 140.75 (2.99) 1.25 (1.26) 139.00 (0.00) 0.00 (7.07)
    Median 141.00 1.00 140.00 1.00 139.00 0.00
    Min - Max 139.00 - 143.00 -1.00 - 2.00 138.00 - 145.00 0.00 - 3.00 139.00 - 139.00 -5.00 - 5.00
Week 16





    n 5 5 4 4 2 2
    Mean (SD) 140.80 (1.10) 0.40 (0.89) 142.00 (3.56) 2.50 (1.91) 139.50 (0.71) 0.50 (6.36)
    Median 141.00 1.00 141.00 2.00 139.50 0.50
    Min - Max 139.00 - 142.00 -1.00 - 1.00 139.00 - 147.00 1.00 - 5.00 139.00 - 140.00 -4.00 - 5.00
Week 20





    n 5 5 4 4 2 2
    Mean (SD) 141.60 (1.67) 1.20 (1.92) 138.75 (3.59) -0.75 (2.22) 137.50 (0.71) -1.50 (6.36)
    Median 142.00 2.00 137.50 -1.00 137.50 -1.50
    Min - Max 139.00 - 143.00 -2.00 - 3.00 136.00 - 144.00 -3.00 - 2.00 137.00 - 138.00 -6.00 - 3.00
Week 24





    n 5 5 4 4 2 2
    Mean (SD) 140.40 (1.14) 0.00 (1.22) 139.25 (3.59) -0.25 (2.63) 138.00 (2.83) -1.00 (4.24)
    Median 140.00 0.00 140.50 0.50 138.00 -1.00
    Min - Max 139.00 - 142.00 -2.00 - 1.00 134.00 - 142.00 -4.00 - 2.00 136.00 - 140.00 -4.00 - 2.00
Week 26





    n 5 5 4 4 2 2
    Mean (SD) 140.60 (2.51) 0.20 (2.77) 138.75 (4.57) -0.75 (2.87) 142.50 (2.12) 3.50 (4.95)
    Median 140.00 -1.00 138.00 -1.00 142.50 3.50
    Min - Max 139.00 - 145.00 -2.00 - 5.00 134.00 - 145.00 -4.00 - 3.00 141.00 - 144.00 0.00 - 7.00
tbl_baseline_chg( data = df, baseline_level = "Baseline", by = "TRTA", denominator = cards::ADSL ) |> add_overall(last = TRUE, col_label = "All Participants") #> Converting column "TRTA" to a factor.
Visit
Placebo
(N = 86)
Xanomeline High Dose
(N = 84)
Xanomeline Low Dose
(N = 84)
All Participants
Value at Visit Change from Baseline Value at Visit Change from Baseline Value at Visit Change from Baseline Value at Visit Change from Baseline
Baseline







    n 7
7
6
20
    Mean (SD) 141.14 (1.46)
139.14 (2.19)
139.50 (4.23)
139.95 (2.78)
    Median 141.00
139.00
138.50
140.00
    Min - Max 140.00 - 144.00
136.00 - 142.00
134.00 - 145.00
134.00 - 145.00
Week 2







    n 7 7 6 6 6 6 19 19
    Mean (SD) 140.57 (1.62) -0.6 (1.9) 138.83 (3.25) 0.2 (3.5) 139.50 (2.35) 0.0 (3.7) 139.68 (2.43) -0.2 (2.9)
    Median 141.00 -1.0 140.50 0.5 139.50 -0.5 140.00 -1.0
    Min - Max 138.00 - 142.00 -3.0 - 2.0 133.00 - 141.00 -5.0 - 5.0 136.00 - 142.00 -5.0 - 5.0 133.00 - 142.00 -5.0 - 5.0
Week 4







    n 7 7 6 6 5 5 18 18
    Mean (SD) 139.29 (2.81) -1.86 (2.54) 139.83 (3.54) 1.17 (2.04) 139.40 (1.34) -0.60 (3.51) 139.50 (2.64) -0.50 (2.85)
    Median 140.00 -1.00 138.50 0.00 140.00 0.00 139.50 0.00
    Min - Max 134.00 - 142.00 -7.00 - 0.00 138.00 - 147.00 0.00 - 5.00 138.00 - 141.00 -5.00 - 4.00 134.00 - 147.00 -7.00 - 5.00
Week 6







    n 5 5 6 6 4 4 15 15
    Mean (SD) 140.00 (1.87) -0.40 (1.67) 139.67 (1.97) 1.00 (2.28) 140.50 (2.65) 1.75 (5.38) 140.00 (2.00) 0.73 (3.10)
    Median 140.00 0.00 139.00 0.50 140.00 2.50 139.00 0.00
    Min - Max 138.00 - 143.00 -2.00 - 2.00 138.00 - 143.00 -1.00 - 5.00 138.00 - 144.00 -5.00 - 7.00 138.00 - 144.00 -5.00 - 7.00
Week 8







    n 5 5 4 4 3 3 12 12
    Mean (SD) 140.60 (1.52) 0.20 (1.64) 139.00 (2.16) -0.50 (2.38) 139.00 (2.65) 0.00 (3.46) 139.67 (2.02) -0.08 (2.19)
    Median 141.00 1.00 139.50 -0.50 140.00 2.00 140.00 1.00
    Min - Max 139.00 - 142.00 -2.00 - 2.00 136.00 - 141.00 -3.00 - 2.00 136.00 - 141.00 -4.00 - 2.00 136.00 - 142.00 -4.00 - 2.00
Week 12







    n 5 5 4 4 2 2 11 11
    Mean (SD) 141.00 (1.58) 0.60 (1.14) 140.75 (2.99) 1.25 (1.26) 139.00 (0.00) 0.00 (7.07) 140.55 (2.07) 0.73 (2.49)
    Median 141.00 1.00 140.00 1.00 139.00 0.00 140.00 1.00
    Min - Max 139.00 - 143.00 -1.00 - 2.00 138.00 - 145.00 0.00 - 3.00 139.00 - 139.00 -5.00 - 5.00 138.00 - 145.00 -5.00 - 5.00
Week 16







    n 5 5 4 4 2 2 11 11
    Mean (SD) 140.80 (1.10) 0.40 (0.89) 142.00 (3.56) 2.50 (1.91) 139.50 (0.71) 0.50 (6.36) 141.00 (2.28) 1.18 (2.56)
    Median 141.00 1.00 141.00 2.00 139.50 0.50 141.00 1.00
    Min - Max 139.00 - 142.00 -1.00 - 1.00 139.00 - 147.00 1.00 - 5.00 139.00 - 140.00 -4.00 - 5.00 139.00 - 147.00 -4.00 - 5.00
Week 20







    n 5 5 4 4 2 2 11 11
    Mean (SD) 141.60 (1.67) 1.20 (1.92) 138.75 (3.59) -0.75 (2.22) 137.50 (0.71) -1.50 (6.36) 139.82 (2.86) 0.00 (2.90)
    Median 142.00 2.00 137.50 -1.00 137.50 -1.50 139.00 1.00
    Min - Max 139.00 - 143.00 -2.00 - 3.00 136.00 - 144.00 -3.00 - 2.00 137.00 - 138.00 -6.00 - 3.00 136.00 - 144.00 -6.00 - 3.00
Week 24







    n 5 5 4 4 2 2 11 11
    Mean (SD) 140.40 (1.14) 0.00 (1.22) 139.25 (3.59) -0.25 (2.63) 138.00 (2.83) -1.00 (4.24) 139.55 (2.46) -0.27 (2.15)
    Median 140.00 0.00 140.50 0.50 138.00 -1.00 140.00 0.00
    Min - Max 139.00 - 142.00 -2.00 - 1.00 134.00 - 142.00 -4.00 - 2.00 136.00 - 140.00 -4.00 - 2.00 134.00 - 142.00 -4.00 - 2.00
Week 26







    n 5 5 4 4 2 2 11 11
    Mean (SD) 140.60 (2.51) 0.20 (2.77) 138.75 (4.57) -0.75 (2.87) 142.50 (2.12) 3.50 (4.95) 140.27 (3.35) 0.45 (3.24)
    Median 140.00 -1.00 138.00 -1.00 142.50 3.50 140.00 -1.00
    Min - Max 139.00 - 145.00 -2.00 - 5.00 134.00 - 145.00 -4.00 - 3.00 141.00 - 144.00 0.00 - 7.00 134.00 - 145.00 -4.00 - 7.00