Builds the gt table that write_html() and write_pdf() save, styled with a facade, so you can show it in a Quarto or R Markdown document, a Shiny app, or style it further with gt.
Usage
as_gt(
data,
title = NULL,
subtitle = NULL,
source_note = NULL,
footnotes = NULL,
names_separator = "__",
facade = get_tsg_facade(which = "html")
)Arguments
- data
A
tsgtable or a data frame.- title
Optional title; defaults to the table's title (see
add_table_title()).- subtitle
Optional subtitle; defaults to the table's subtitle.
- source_note
Optional source note; defaults to the table's source note.
- footnotes
Optional character vector of footnotes; defaults to the table's footnotes.
- names_separator
Column name separator for spanners. Default
"__".- facade
A built-in facade name (e.g.
"booktabs"; seeget_tsg_facade()), the path to a.yamlor.jsonfacade file, or a facade list. Keys missing from it fall back to the html default facade; settings added withadd_facade()take precedence over it.
Examples
person_record |>
generate_crosstab(marital_status, sex) |>
add_table_title("Marital status by sex") |>
as_gt(facade = "booktabs")
Marital status by sex