Skip to contents

Saves a gtsummary table as a Word, PDF, or HTML file

Usage

save_table(tbl, filename = "table", format = c("docx", "pdf", "html"))

Arguments

tbl

A gtsummary object (e.g., tbl_regression(), tbl_summary()).

filename

File name to save the output. Extension is optional.

format

Output format. One of "docx", "pdf", or "html".

Value

Saves the file to a temporary directory (if no path is given). Does not return an object.

Examples

# \donttest{
model <- glm(mpg ~ hp + wt, data = mtcars)
tbl <- gtsummary::tbl_regression(model)
save_table(tbl, filename = file.path(tempdir(), "regression_table"), format = "docx")
#> Table saved at: /tmp/Rtmp9h6NFv/regression_table.docx
# }