View source: R/plot_centrality_by_group.R
| plot_centrality_by_group | R Documentation |
Plot centrality measures by group
plot_centrality_by_group(
networks_groups,
replacements,
measure_spec,
color_palette = c("#FF5733", "#33FFCE")
)
networks_groups |
A named list of two network objects. |
replacements |
Character vector of length 2 with group replacement names. |
measure_spec |
Character string specifying the centrality measure. |
color_palette |
Character vector of two colors for the groups. |
A list with elements plot (a ggplot object) and table (a data frame).
set.seed(123)
n <- 300
f1 <- rnorm(n)
f2 <- 0.3 * f1 + rnorm(n)
items <- data.frame(
sapply(1:4, function(i) 0.7 * f1 + rnorm(n, 0, 0.7)),
sapply(1:4, function(i) 0.7 * f2 + rnorm(n, 0, 0.7))
)
names(items) <- c(paste0("A", 1:4), paste0("B", 1:4))
items$sex <- rep(c("Female", "Male"), each = n / 2)
nets <- estimate_networks_by_group(items, group_var = "sex",
columns = names(items)[1:8],
default = "EBICglasso")
res <- plot_centrality_by_group(nets, replacements = c("Female", "Male"),
measure_spec = "ExpectedInfluence")
res$plot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.