View source: R/centrality_bridge_plot.R
| centrality_bridge_plot | R Documentation |
Creates a comparative bridge centrality plot for two groups.
centrality_bridge_plot(
networks_groups,
group_names = c("Mujer", "Varón"),
measure = "Bridge Expected Influence (1-step)",
color_palette = c("#FF5733", "#33FFCE"),
communities = NULL
)
networks_groups |
Named list of network objects by group. |
group_names |
Character vector of length 2 with group names. |
measure |
Bridge centrality measure name. |
color_palette |
Character vector of 2 colors for the groups. |
communities |
Community membership vector for bridge calculation. |
A list with table (a data frame with the bridge centrality of
each node in each group, raw and as z-scores) and plot (a ggplot
object).
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 <- centrality_bridge_plot(nets, group_names = c("Female", "Male"),
communities = rep(c("A", "B"), each = 4))
res$plot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.