View source: R/networks_to_alluv.R
networks_to_alluv | R Documentation |
This function creates a data.frame that can be easily plotted with ggalluvial from a list of networks.
networks_to_alluv(
graphs,
intertemporal_cluster_column,
node_id,
summary_cluster_stats = TRUE,
keep_color = TRUE,
color_column = "color",
keep_cluster_label = TRUE,
cluster_label_column = "cluster_label"
)
graphs |
A tibble graph from tidygraph or a list of tibble graphs. |
intertemporal_cluster_column |
The column with the identifier of the inter-temporal cluster. If you have used
add_clusters() and merge_dynamic_clusters(),
it is of the form |
node_id |
The column with the unique identifier of each node. |
summary_cluster_stats |
If set to
|
keep_color |
Set to |
color_column |
The name of the column with the colors of the categories in |
keep_cluster_label |
Set to |
cluster_label_column |
The name of the column with the name/label associated to the categories in
|
library(networkflow)
nodes <- Nodes_stagflation |>
dplyr::rename(ID_Art = ItemID_Ref) |>
dplyr::filter(Type == "Stagflation")
references <- Ref_stagflation |>
dplyr::rename(ID_Art = Citing_ItemID_Ref)
temporal_networks <- build_dynamic_networks(nodes = nodes,
directed_edges = references,
source_id = "ID_Art",
target_id = "ItemID_Ref",
time_variable = "Year",
cooccurrence_method = "coupling_similarity",
time_window = 20,
edges_threshold = 1,
overlapping_window = TRUE,
filter_components = TRUE,
verbose = FALSE)
temporal_networks <- add_clusters(temporal_networks,
objective_function = "modularity",
clustering_method = "leiden",
verbose = FALSE)
temporal_networks <- merge_dynamic_clusters(temporal_networks,
cluster_id = "cluster_leiden",
node_id = "ID_Art",
threshold_similarity = 0.51,
similarity_type = "partial")
temporal_networks <- name_clusters(graphs = temporal_networks,
method = "tf-idf",
name_merged_clusters = TRUE,
cluster_id = "dynamic_cluster_leiden",
text_columns = "Title",
nb_terms_label = 5,
clean_word_method = "lemmatise")
temporal_networks <- color_networks(graphs = temporal_networks,
column_to_color = "dynamic_cluster_leiden",
color = NULL)
alluv_dt <- networks_to_alluv(temporal_networks,
intertemporal_cluster_column = "dynamic_cluster_leiden",
node_id = "ID_Art")
alluv_dt[1:5]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.