Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


multimedia (version 0.2.0)

bind_mediation: Convert mediation_data to a single data.frame

Description

It can be helpful to combine all the data in a mediation_data S4 object into a single data.frame. This concatenates all data sources horizontally, into an N samples x (all outcomes, mediators, treatments, ...) matrix.

Usage

bind_mediation(exper)

Value

A data.frame containing all variables from the original mediation_data object.

Arguments

exper

An object of class mediation_data containing the variables that we want horizontally concatenated.

Examples

Run this code
exper <- demo_joy() |>
    mediation_data("PHQ", "treatment", starts_with("ASV"))
exper
bind_mediation(exper)

exper <- demo_spline(tau = c(2, 1)) |>
    mediation_data(starts_with("outcome"), "treatment", "mediator")
exper
bind_mediation(exper)

Run the code above in your browser using DataLab