change_node_label {semptools} | R Documentation |
Change node labels
Description
Change the labels of selected nodes.
Usage
change_node_label(
semPaths_plot,
label_list = NULL,
label.cex,
label.scale,
label.prop,
label.norm
)
Arguments
semPaths_plot |
A qgraph::qgraph object generated by semPlot::semPaths, or a similar qgraph object modified by other semptools functions. |
label_list |
A list of named lists. Each named list should
have two named values: |
label.cex |
Identical to the same argument in
|
label.scale |
Identical to the same argument in
semPlot::semPaths. A logical value that determine whether labels
wil be scaled (resized) to the nodes they attach to. It has no
default. If not set, then this option in the |
label.prop |
Identical to the same argument in
semPlot::semPaths. A numeric vector of length equal to the number
of nodes. If |
label.norm |
Identical to the same argument in
semPlot::semPaths. It must be a string. All labels as wide as or
narrower than this string will have the same font size, while all
labels wider than this string will be rescaled to have the same
width as this string. It has no default. If not set, then this
option in the |
Details
Modify a qgraph::qgraph object generated by semPlot::semPaths and change the labels of selected nodes.
Value
A qgraph::qgraph based on the original one, with node attributes of selected nodes modified.
Examples
library(semPlot)
library(lavaan)
mod_pa <-
'x1 ~~ x2
x3 ~ x1 + x2
x4 ~ x1 + x3
'
fit_pa <- sem(mod_pa, pa_example)
parameterEstimates(fit_pa)[, c("lhs", "op", "rhs", "est", "pvalue")]
m <- matrix(c("x1", NA, NA,
NA, "x3", "x4",
"x2", NA, NA), byrow = TRUE, 3, 3)
p_pa <- semPaths(fit_pa, whatLabels="est",
style = "ram",
nCharNodes = 0, nCharEdges = 0,
layout = m)
my_label_list <- list(list(node = "x3", to = "mediator"),
list(node = "x4", to = expression(gamma)))
p_pa2 <- change_node_label(p_pa, my_label_list)
plot(p_pa2)