Learn R Programming

gt (version 0.5.0)

as_rtf: Output a gt object as RTF

Description

Get the RTF content from a gt_tbl object as as a single-element character vector. This object can be used with writeLines() to generate a valid .rtf file that can be opened by RTF readers.

Usage

as_rtf(data, page_numbering = c("none", "footer", "header"))

Arguments

data

A table object that is created using the gt() function.

page_numbering

An option to include page numbering in the RTF document. The page numbering text can either be in the document "footer" or "header". By default, page numbering is not active ("none").

Function ID

13-4

See Also

Other Export Functions: as_latex(), as_raw_html(), extract_summary(), gtsave()

Examples

Run this code
# NOT RUN {
if (interactive()) {

# Use `gtcars` to create a gt table;
# add a header and then export as
# RTF code
tab_rtf <-
  gtcars %>%
  dplyr::select(mfr, model) %>%
  dplyr::slice(1:2) %>%
  gt() %>%
  tab_header(
    title = md("Data listing from **gtcars**"),
    subtitle = md("`gtcars` is an R dataset")
  ) %>%
  as_rtf()

}

# }

Run the code above in your browser using DataLab