This function takes a data.frame like with two or three columns: `FROM` and `TO` (and potentially `VALUE`) and outputs a list containing two dataframes: Nodes and Edges. The simplest way to accomplish this task would be to create an edge list using the igraph function `igraph::from_edgelist()`, and then subsequently we could use `igraph::as_data_frame()` to create each data.frame. This function provides some additional functionality for convenience for the extremely lazy, suitable for subsequent manipulation
edgeListToNodesEdges( df, addLabel = TRUE, addHover = FALSE, col1 = "#A58FAA", col2 = "#A6D6D6", Index = 1, printResults = F )
df | dataframe with edgeList |
---|---|
addLabel | should the node names be displayed? |
addHover | should the node names be displayed on hover? |
col1 | what color should from nodes be?, Default: #A58FAA |
col2 | what color should from nodes be?, Default: #A6D6D6 |
Index | Should the IDs of nodes start from 0 or 1. The indexing is important. By default, the edges will be 1-indexed (for VisNetwork), but if you're using network3d, change the indexing to 0, Default: 1 |
printResults | View node degrees to help w/ trim limits? |
output will be a list containing both dataframes
nothin