View source: R/network_analysis.R
make_graph_from_veda_df | R Documentation |
Use the full dataset from prep_data to create an igraph graph. Processes are nodes and commodity flows are represented by edges. When the data is for a single year, the edge weights are the values are determined by the var_fin and var_fout variables of the given process/commodity. Note that since TIMES does not give information of how a given var_fout is split over downstream commodities, an assumption has to be made. Here, the weight is assigned in proportion to the ratio of var_fin variables of downstream commodities linked to the originating process.
make_graph_from_veda_df( dat, node_labels = process_description, edge_labels = commodity_description, input_data_type = "vd" )
dat |
Tibble output from prep_data() %>% define_sector_from_*(). |
node_labels |
Column in dat for labelling nodes. |
edge_labels |
Column in dat for labelling edges. |
input_data_type |
Character. "vd" or "vdt" |
igraph graph object. Edge attributes: commodity, commodity description
data(demos_001_sector) g <- demos_001_sector %>% make_graph_from_veda_df(node_labels = process_description, edge_labels = commodity_description ) E(g) E(g)$weight E(g)$commodity # If a singe period selected, the weight is set to the var_fout pv g_w <- demos_001_sector %>% filter(period == 2005) %>% make_graph_from_veda_df(node_labels = process_description, edge_labels = commodity_description ) E(g_w) E(g_w)$weight E(g_w)$commodity
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.