theme_mediation {robmedExtra}R Documentation

Theme for formatting a flextable of results from (robust) mediation analysis

Description

Apply a theme to a flextable intended to format results from (robust) mediation analysis. The theme uses additional information from subclass "mediation_flextable", and it formats the table according to APA style.

Usage

theme_mediation(x, ...)

Arguments

x

an object of class "flextable". It is recommend to use this theme only for objects of subclass "mediation_flextable", as returned by to_flextable().

...

additional arguments are currently ignored.

Details

Theme functions for flextables are not like ggplot2 themes, as they are applied to the existing table immediately. For example, if you add a row in the footer after setting the theme, the new row is not formatted with the theme. The theme is applied only to existing elements when the function is called.

That is, if you modify the table returned by to_flextable(), it may be necessary to apply the theme function again after all elements of the table have been added (e.g., additional header or footer rows).

Value

An object inheriting from class "flextable".

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)
# add additional row to the footer
footer_line <- paste("Additional explanations on the conducted",
                     "analysis.")
ft <- flextable::add_footer_lines(ft, values = footer_line)
ft <- theme_mediation(ft)
ft


[Package robmedExtra version 0.1.0 Index]