Skip to contents

Update column alignment/justification in a gtsummary table.

Usage

modify_column_alignment(x, columns, align = c("left", "right", "center"))

Arguments

x

(gtsummary)
gtsummary object

columns

(tidy-select)
Selector of columns in x$table_body

align

(string) String indicating alignment of column, must be one of c("left", "right", "center")

Examples

# Example 1 ----------------------------------
lm(age ~ marker + grade, trial) %>%
  tbl_regression() %>%
  modify_column_alignment(columns = everything(), align = "left")
Characteristic Beta 95% CI1 p-value
Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9
Grade


    I
    II 0.64 -4.7, 6.0 0.8
    III 2.4 -2.8, 7.6 0.4
1 CI = Confidence Interval