mediation_data | R Documentation |
mediation_data
ConstructorConvert a SummarizedExperiment, phyloseq object, or data.frame into a
mediation_data
object. This conversion helps to organize the variables that
lie on different parts of the mediation analysis graph, so that they are not
all kept in a homogeneous experiment or data.frame. It's possible to specify
outcome, mediator, or treatment variables using either string vectors or
tidyselect syntax, e.g., starts_with("mediator_")
will match all columns of
the input data starting with the string mediator.
mediation_data(x, outcomes, treatments, mediators, pretreatments = NULL)
x |
A SummarizedExperiment, phyloseq object, or data.frame whose columns contain all the variables needed for the mediation analysis. |
outcomes |
A vector or tidyselect specification of the names of all outcome variables. |
treatments |
A vector or tidyselect specification of the names of all treatment variables. |
mediators |
A vector or tidyselect specification of the names of all mediators. |
pretreatments |
A vector containing names of all pretreatment variables. Defaults to NULL, in which case the pretreatments slot will remain empty. |
result An object of class mediation_data
, with separate slots for
each of the node types in a mediation analysis diagram.
mediation_data-class
# multiple outcomes, one mediator
mediation_data(
demo_spline(), starts_with("outcome"), "treatment", "mediator"
)
# one outcome, multiple mediators
mediation_data(demo_joy(), "PHQ", "treatment", starts_with("ASV"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.