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 "flextable", or an object containing results from (robust) mediation analysis that can be converted to the subclass "mediation_flextable" via to_flextable().

file

a character string specifying the path an file name for the Microsoft Word file to be generated.

...

for the "flextable" method, additional arguments to be passed down to prop_section() for defining page composition such as page size, page orientation, and margins. For the default method, additional arguments to be passed down to to_flextable() for converting results from (robust) mediation analysis.

size

a character string specifying the page size. Possible values are "A4" for A4 format (297 x 210 mm) or "letter" for US letter format (11 x 8.5 inches).

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

export_pptx()

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)


[Package robmedExtra version 0.1.0 Index]