Typical use is tabulating changes from baseline measurement of an Analysis Variable.
tbl_baseline_chg(
data,
baseline_level,
denominator,
by = NULL,
split_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 = {style_roche_number(n)})",
...
)(data.frame)
A data frame.
(string)
String identifying baseline level in the visit variable.
(string)
Data set used to compute the header counts (typically ADSL).
(tidy-select)
A single column from data. Summary statistics will be stratified by this variable.
Default is NULL.
(string)
String identifying the variable to split the table by. Default is NULL. Usually
used with 'PARAM' variables to produce a list of tables for each parameter. Subtitles
highlight the split levels.
(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.
(string)
String identifying the unique subjects. Default is 'USUBJID'.
(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.
(string)
String identifying the visit or analysis sequence number. Default is
'AVISITN'.
(string)
String identifying the analysis values. Default is 'AVAL'.
(string)
String identifying the change from baseline values. Default is 'CHG'.
(tbl_summary, tbl_svysummary, tbl_continuous, tbl_custom_summary)
A stratified 'gtsummary' table
(scalar logical)
Logical indicator to display overall column last in table.
Default is FALSE, which will display overall column first.
(string)
String indicating the column label. Default is "**Overall** \nN = {style_number(N)}"
These dots are for future extensions and must be empty.
A gtsummary table, or a named list of gtsummary tables if split_by is specified.
theme_gtsummary_roche()
#> Setting theme "Roche"
df <- cards::ADLB |>
dplyr::mutate(AVISIT = trimws(AVISIT)) |>
dplyr::filter(
AVISIT != "End of Treatment",
PARAMCD %in% c("SODIUM", "K")
)
tbl_baseline_chg(
data = df |> dplyr::filter(PARAMCD == "SODIUM"),
baseline_level = "Baseline",
by = "TRTA",
denominator = cards::ADSL
)
#> ℹ Converting column "TRTA" to a factor.
Value at Visit
Change from Baseline
Value at Visit
Change from Baseline
Value at Visit
Change from Baseline
tbl_baseline_chg(
data = df |> dplyr::filter(PARAMCD == "K"),
baseline_level = "Baseline",
by = "TRTA",
denominator = cards::ADSL
) |>
add_overall(last = TRUE, col_label = "All Participants")
#> ℹ Converting column "TRTA" to a factor.
Value at Visit
Change from Baseline
Value at Visit
Change from Baseline
Value at Visit
Change from Baseline
Value at Visit
Change from Baseline
# Split by PARAM
tbl_baseline_chg(
data = df,
baseline_level = "Baseline",
by = "TRTA",
split_by = "PARAM",
denominator = cards::ADSL
)
#> ℹ Building table for "PARAM" = "Sodium (mmol/L)"
#> ℹ Converting column "TRTA" to a factor.
#> ℹ Building table for "PARAM" = "Potassium (mmol/L)"
#> ℹ Converting column "TRTA" to a factor.
#> $`Sodium (mmol/L)`
#>
#> $`Potassium (mmol/L)`
#>