export_docx {robmedExtra} | R Documentation |
Export a flextable of results from (robust) mediation analysis to 'Microsoft Word'
Description
Export a flextable
object to Microsoft
Word. This function is intended for tables of results from (robust)
mediation analysis. It is essentially a wrapper for
save_as_docx()
with a more convenient argument
for page size, and it uses additional information from subclass
"mediation_flextable"
to determine the page
orientation.
Usage
export_docx(object, file, ...)
## S3 method for class 'flextable'
export_docx(object, file, size = c("A4", "letter"), ...)
## Default S3 method:
export_docx(object, file, ...)
Arguments
object |
an object of class |
file |
a character string specifying the path an file name for the Microsoft Word file to be generated. |
... |
for the |
size |
a character string specifying the page size. Possible values
are |
Value
The function is called for its side effect of creating a Microsoft Word file. It returns the path to the file invisibly.
Author(s)
Andreas Alfons
See Also
flextable()
, to_flextable()
Examples
data("BSG2014")
# seed to be used for the random number generator
seed <- 20211117
# perform mediation analysis via robust bootstrap test ROBMED
set.seed(seed)
robust_boot <- test_mediation(BSG2014,
x = "ValueDiversity",
y = "TeamCommitment",
m = "TaskConflict",
robust = TRUE)
# construct flextable of results
ft <- to_flextable(robust_boot)
# export to Microsoft Word
file_name <- tempfile(fileext = ".docx")
export_docx(ft, file = file_name)