View source: R/export_to_word.R
| word_export | R Documentation |
Export TernTables output to a formatted Word document
word_export(
tbl,
filename,
round_intg = FALSE,
font_size = 9,
category_start = NULL,
manual_italic_indent = NULL,
manual_underline = NULL,
table_caption = NULL,
table_footnote = NULL,
line_break_header = getOption("TernTables.line_break_header", TRUE)
)
tbl |
A tibble created by ternG or ternD |
filename |
Output file path ending in .docx |
round_intg |
Logical; if TRUE, adds note about integer rounding. Default is FALSE. |
font_size |
Numeric; font size for table body. Default is 9. |
category_start |
Named character vector specifying category headers. Names are header label text; values are anchor variable names – either the original column name or the cleaned display name (both forms accepted). |
manual_italic_indent |
Character vector of display variable names (post-cleaning) to force into italicized and indented formatting, matching the appearance of factor sub-category rows (e.g., levels of a multi-category variable). Use this for rows that should visually appear as sub-items but are not automatically detected as such. |
manual_underline |
Character vector of display variable names (post-cleaning) to force into underlined formatting, matching the appearance of multi-category variable header rows. Use this for rows that should visually appear as section headers but are not automatically detected as such. |
table_caption |
Optional character string to display as a caption above the table in the Word
document. Rendered as size 11 Arial bold, single-spaced with a small gap before the table.
Default is |
table_footnote |
Optional character string to display as a footnote below the table in the Word
document. Rendered as size 6 Arial italic. A double-bar border is applied above and below the
footnote row. Default is |
line_break_header |
Logical; if |
Invisibly returns the path to the written Word file.
data(tern_colon)
tbl <- ternD(tern_colon, exclude_vars = c("ID"), methods_doc = FALSE)
word_export(
tbl = tbl,
filename = file.path(tempdir(), "descriptive.docx"),
category_start = c(
"Patient Demographics" = "Age (yr)",
"Tumor Characteristics" = "Positive Lymph Nodes (n)"
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.