create_edges {DiagrammeR} | R Documentation |
Combine several named vectors for edges and their attributes into a data frame, which can be combined with other similarly-generated data frame, or, added to a graph object.
create_edges(from, to, rel = NULL, ...)
from |
a vector of node ID values from which edges are outbound. The
vector length must equal to that of the |
to |
a vector of node ID values to which edges are incoming. The
vector length must equal to that of the |
rel |
an optional 'rel' description for each edge. |
... |
one or more named vectors for associated attributes. |
a data frame.
## Not run: # Create a simple edge data frame and view results edges <- create_edges(from = c("a", "b", "c"), to = c("d", "c", "a"), rel = "leading_to") render_graph(create_graph(edges_df = edges), output = "visNetwork") # Create an edge data frame with additional parameters edges <- create_edges(from = c("a", "b", "c"), to = c("d", "c", "a"), rel = "leading_to", length = c(50, 100, 250), color = "green", width = c(1, 1, 2)) render_graph(create_graph(edges_df = edges), output = "visNetwork") ## End(Not run)