to_flextable {robmedExtra} | R Documentation |
Tabular summary of results from (robust) mediation analysis
Description
Convert results from (robust) mediation analysis to a tabular summary in
the form of a flextable
. This flextable
can easily be exported to Microsoft Word or Microsoft
Powerpoint, or integrated into a dynamic Markdown document.
This eliminates the risk of mistakes in reporting that stem from
copying-and-pasting results.
Usage
to_flextable(object, ...)
## S3 method for class 'test_mediation'
to_flextable(object, type = c("boot", "data"), ...)
## S3 method for class 'summary_test_mediation'
to_flextable(object, p_value = FALSE, ...)
## S3 method for class 'list'
to_flextable(
object,
type = c("boot", "data"),
p_value = FALSE,
orientation = c("landscape", "portrait"),
...
)
Arguments
object |
an object inheriting from class
|
... |
additional arguments to be passed down, eventually to
|
type |
a character string specifying which estimates and significance
tests to report if mediation analysis was done via a bootstrap procedure.
If |
p_value |
a logical indicating whether to include p-values for the
indirect effects if mediation analysis was done via a bootstrap procedure
(defaults to |
orientation |
a character string specifying how to arrange the results
from different objects (list elements) in the |
Value
An object of class "mediation_flextable"
, which inherits
from class "flextable"
.
Note
Numbers are not formatted via flextable
defaults (see
set_flextable_defaults()
), but instead via
formatC()
. This is done to ensure consistency in
number formatting between functions to_flextable()
and
to_latex()
.
Author(s)
Andreas Alfons, based on code by Vincent Drenth
References
Alfons, A., Ates, N.Y. and Groenen, P.J.F. (2022a) A Robust Bootstrap Test for Mediation Analysis. Organizational Research Methods, 25(3), 591–617. doi:10.1177/1094428121999096.
Alfons, A., Ates, N.Y. and Groenen, P.J.F. (2022b) Robust Mediation Analysis: The R Package robmed. Journal of Statistical Software, 103(13), 1–45. doi:10.18637/jss.v103.i13.
See Also
test_mediation()
,
summary()
export_docx()
, export_pptx()
to_latex()
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
to_flextable(robust_boot)
# perform mediation analysis via the OLS bootstrap
set.seed(seed)
ols_boot <- test_mediation(BSG2014,
x = "ValueDiversity",
y = "TeamCommitment",
m = "TaskConflict",
robust = FALSE)
# construct flextable of results from both procedures
boot_list <- list(ols_boot, robust_boot)
to_flextable(boot_list)
# customize labels for procedures and number of digits
boot_list_named <- list("Non-robust" = ols_boot,
"Robust" = robust_boot)
to_flextable(boot_list_named, digits = 4)