# \donttest{
# Basic usage - text formatting then color
gtsummary::trial |>
gtsummary::tbl_summary(by = trt) |>
extras() |>
gtsummary::add_variable_group_header(
header = "Patient Characteristics",
variables = age:stage
) |>
add_group_styling() |>
add_group_colors()
# Custom color - light blue
gtsummary::trial |>
gtsummary::tbl_summary(by = trt) |>
extras() |>
gtsummary::add_variable_group_header(
header = "Baseline Characteristics",
variables = age:marker
) |>
add_group_styling() |>
add_group_colors(color = "#E3F2FD")
# Bold only formatting with custom color
gtsummary::trial |>
gtsummary::tbl_summary(by = trt) |>
extras() |>
gtsummary::add_variable_group_header(
header = "Clinical Measures",
variables = marker:stage
) |>
add_group_styling(format = "bold") |>
add_group_colors(color = "#FFF9E6")
# Multiple group headers
gtsummary::trial |>
gtsummary::tbl_summary(by = trt) |>
extras() |>
gtsummary::add_variable_group_header(
header = "Demographics",
variables = age
) |>
gtsummary::add_variable_group_header(
header = "Disease Measures",
variables = marker:response
) |>
add_group_styling() |>
add_group_colors(color = "#E8E8E8")
# }
Run the code above in your browser using DataLab