Single-page convenience wrapper around as_rtftables(): takes a gt_tbl,
a gtsummary table, an
rtables/tern VTableTree, an rlistings listing_df, a flextable, a
huxtable, or a plain data.frame / tibble, and returns one rtftable
(rather than a list of pages). It is exactly
as_rtftables(x, read_meta = read_meta, split = "none", ...)[[1]].
Arguments
- x
A
gt_tbl, a gtsummary table, an rtables/ternVTableTree, an rlistingslisting_df, aflextable, ahuxtable, or a plaindata.frame/ tibble. Agt_group(gt::gt_group()/gt::gt_split(), or a tfrmtpage_planrender) or a gtsummarytbl_splitcontainer is accepted when it holds exactly one table; multi-member containers error – convert those withas_rtftables().- read_meta
TRUE(default, read all render-relevant metadata),FALSE(rendered body only), or a character vector of tokens. Seeas_rtftables().- ...
Passed to
rtftable()(and on toas_rtftables()). Explicit values always win over the values extracted from the source table.- gt_obj
The old name of
x: deprecated in 0.8.x (warns once a session, still works), removed in 0.9.0.
Details
The body is the table's rendered body (gt via gt::extract_body(),
rtables via formatters::matrix_form()); only render-relevant metadata is
read. See as_rtftables() for the full What is carried, by source
table – in short: column labels, alignment, spanning headers, widths,
titles, footnotes, in-cell footnote marks and (for gt/gtsummary) explicit
tab_style() borders and text styles are carried; cell fills, fonts, gt
theme borders and Markdown are not.
See also
as_rtftables() for the paginating, list-returning version and
the per-source metadata table.
Examples
library(gt)
g <- gt(head(mtcars, 5)) |>
cols_label(mpg = "MPG", cyl = "Cyl") |>
cols_align("right", columns = c(mpg, cyl))
tbl <- as_rtftable(g)