library(gtsummary)
<- gtsummary::tbl_summary(gtsummary::trial, by = trt, include = c(age, grade), missing = "always", label = list(age = "Age")) |> add_overall()
tbl
<- tbl$table_body |>
gt_table ::gt(caption = gt::md("This is the caption \n[Used for cross referencing in Quarto]")) |>
gt::cols_align(columns = c(stat_1, stat_2), align = "right") |>
gt::cols_align(columns = c(variable, var_type), align = "center") |>
gt::cols_align(columns = c(row_type, var_label), align = "left") gt
Alignment
Testing Alignments output
gt_save PDF
::gtsave(gt_table, filename = "outputs/pdf/alignment_gt_pdf.pdf") gt
rmarkdown rendered PDF
gt_table
gt_save rendered word file
::gtsave(gt_table, filename = "outputs/docx/alignment_gt_word.docx") gt
quarto rendered word file
gt_table
rmarkdown rendered word file
gt_table