Merge the levels of moderators generated by mod_levels() into a data frame.
merge_mod_levels(...)
Arguments
...: The output from mod_levels(), or a list of levels generated by mod_levels_list().
Returns
A wlevels-class object, which is a data frame of the combinations of levels, with additional attributes about the levels.
Details
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().
Examples
data(data_med_mod_ab)dat <- data_med_mod_ab
# Form the levels from a list of lm() outputslm_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)
See Also
mod_levels() on generating the levels of a moderator.