View source: R/plot-plot_sem.R
| get_edges | R Documentation |
Attempts to extract edges from a SEM model object, where edges are defined as regression paths and covariances between variables (nodes).
get_edges(x, label = "est_sig", ...)
x |
A model object of class |
label |
Either a character, indicating which column to use for edge
labels, or an expression. See Details.
Defaults to |
... |
Additional parameters passed to |
The function get_edges identifies all regression paths,
latent variable definitions, and covariances in the model as edges.
The output of table_results for those
paths is used to label the edges.
One way to create custom edge labels is by passing an expression to
label. When an expression is
passed to label, it is evaluated in the context of a data.frame
containing the results
of a call to table_results on the x argument.
Another way to create custom labels is by requesting auxiliary variables
using the columns argument (which is passed to
table_results), and then using these columns to construct a new
label. See examples.
An object of class 'tidy_edges'
# Standard use
library(lavaan)
res <- sem("dist ~ speed", cars)
get_edges(res)
# Pass an expression to the 'label' argument for custom labels
get_edges(res, label = paste(est_sig, confint))
# Pass the argument 'columns' to table_results through '...' to retain
# auxiliary columns for further processing
edg <- get_edges(res, columns = c("est_sig", "confint"))
edg
edg <- within(edg, {label <- paste(est_sig, confint)})
edg
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.