# \donttest{
# Default formatting (bold and italic)
gtsummary::trial |>
gtsummary::tbl_summary(by = trt, include = c(age, marker, grade)) |>
gtsummary::add_variable_group_header(
header = "Patient Characteristics",
variables = age:grade
) |>
add_group_styling()
# Bold only
gtsummary::trial |>
gtsummary::tbl_summary(by = trt, include = c(age, marker)) |>
gtsummary::add_variable_group_header(
header = "Demographics",
variables = age:marker
) |>
add_group_styling(format = "bold")
# Multiple group headers
gtsummary::trial |>
gtsummary::tbl_summary(by = trt) |>
gtsummary::add_variable_group_header(
header = "Demographics",
variables = age
) |>
gtsummary::add_variable_group_header(
header = "Clinical Measures",
variables = marker:response
) |>
add_group_styling()
# Custom indentation for grouped variables
gtsummary::trial |>
gtsummary::tbl_summary(by = trt, include = c(age, marker)) |>
gtsummary::add_variable_group_header(
header = "Patient Measures",
variables = age:marker
) |>
add_group_styling(indent_labels = 4L) # Variables indented under header
# }
Run the code above in your browser using DataLab