save_with_rmarkdown.Rd
Save Input via R markdown.
save_with_rmarkdown(x, path, reference_docx = get_reference_docx("portrait"))
(gtsummary
/gt_tbl
/flextable
/list
)
table object of class 'gtsummary'
, 'gt_tbl'
(gt table) or 'flextable'
, or a list
of table objects.
(path
)
path to save file to, e.g. "rendered_table.docx"
(path
)
Path to reference document that when not NULL
is passed to the
reference_docx:
R markdown field.
(string
)
Output format. For now, only docx
output type is supported.
x (invisibly)
# create table
tbl <-
cards::ADAE[1:150,] |>
gtsummary::tbl_hierarchical(
variables = c(AESOC, AETERM),
by = TRTA,
denominator = cards::ADSL,
id = USUBJID,
)
# save as docx
gtsummary::as_flex_table(tbl) |>
save_with_rmarkdown(path = tempfile(fileext = ".docx"))
#> ✔ Writing /tmp/RtmpxRCBPk/file1e385cad4cc4.docx
# split the tqble and save paginatted table
gtsummary::tbl_split_by_rows(tbl, row_numbers = seq(20, nrow(tbl), by = 20)) |>
save_with_rmarkdown(path = tempfile(fileext = ".docx"))
#> Error in seq.default(20, nrow(tbl), by = 20): 'to' must be of length 1