View source: R/merge_mod_levels.R
merge_mod_levels | R Documentation |
Merge the levels of
moderators generated by
mod_levels()
into a data frame.
merge_mod_levels(...)
... |
The output from
|
It merges the levels of
moderators generated by
mod_levels()
into a data frame,
with each row represents a
combination of the levels. The output
is to be used by
cond_indirect_effects()
.
Users usually do not need to use this
function because
cond_indirect_effects()
will merge
the levels internally if necessary.
This function is used when users need
to customize the levels for each
moderator and so cannot use
mod_levels_list()
or the default
levels in cond_indirect_effects()
.
A wlevels
-class object,
which is a data frame of the
combinations of levels, with
additional attributes about the
levels.
mod_levels()
on generating
the levels of a moderator.
data(data_med_mod_ab)
dat <- data_med_mod_ab
# Form the levels from a list of lm() outputs
lm_m <- lm(m ~ x*w1 + c1 + c2, dat)
lm_y <- lm(y ~ m*w2 + x + w1 + c1 + c2, dat)
lm_out <- lm2list(lm_m, lm_y)
w1_levels <- mod_levels(lm_out, w = "w1")
w1_levels
w2_levels <- mod_levels(lm_out, w = "w2")
w2_levels
merge_mod_levels(w1_levels, w2_levels)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.