Titles

Testing Title, Subtitle and Caption output

library(gtsummary)

tbl <- gtsummary::tbl_summary(gtsummary::trial, by = trt, include = c(age, grade), missing = "always", label = list(age = "Age")) |> add_overall()

gt_table <- tbl$table_body |> 
  gt::gt(caption = gt::md("This is the caption")) |> 
  gt::fmt_markdown(columns = label) |> # need this to recognize the line break in the table body
  gt::cols_hide(columns = c(variable, var_type, row_type, var_label)) |> 
  gt::sub_missing(missing_text = "") |> 
  # title, subtitle, and captions
  gt::tab_header(gt::md("This is the Title"), subtitle = "This is the Subtitle")

gt_save PDF

gt::gtsave(gt_table, filename = "outputs/pdf/titles_gt_pdf.pdf")

Preview the Output

rmarkdown rendered PDF

gt_table

Preview the Output

gt_save rendered word file

gt::gtsave(gt_table, filename = "outputs/docx/titles_gt_word.docx")

Preview the Output

quarto rendered word file

gt_table

Preview the Output

rmarkdown rendered word file

gt_table

Preview the Output