View source: R/save_functions.R
save_docx | R Documentation |
Saves a collection of gtsummary tables and ggplot2 plots into a .docx file.
save_docx(tables = NULL, plots = NULL, filename = "report.docx", titles = NULL)
tables |
A list of gtsummary tables. |
plots |
A list of ggplot2 plot objects. |
filename |
File name for the output (with or without .docx extension). |
titles |
Optional. A character vector of titles. |
A Word document saved to a temporary directory (if no path is given). No object is returned.
library(gtsummary)
library(ggplot2)
tbl <- tbl_regression(glm(mpg ~ hp + wt, data = mtcars))
p <- ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point()
save_docx(
tables = list(tbl),
plots = list(p),
filename = file.path(tempdir(), "report.docx"),
titles = c("Table 1: Regression", "Figure 1: Scatterplot")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.