merge_mod_levels: Merge the Generated Levels of Moderators

View source: R/merge_mod_levels.R

merge_mod_levelsR Documentation

Merge the Generated Levels of Moderators

Description

Merge the levels of moderators generated by mod_levels() into a data frame.

Usage

merge_mod_levels(...)

Arguments

...

The output from mod_levels(), or a list of levels generated by mod_levels_list().

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().

Value

A wlevels-class object, which is a data frame of the combinations of levels, with additional attributes about the levels.

See Also

mod_levels() on generating the levels of a moderator.

Examples


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)


manymome documentation built on Oct. 4, 2024, 5:10 p.m.