View source: R/create_edge_df.R
| create_edge_df | R Documentation | 
Combine several vectors for edges and their attributes into a data frame, which can be combined with other similarly-generated data frames, or, added to a graph object. An edge data frame, or edf, has at least the following columns:
id (of type integer)
from (of type integer)
to (of type integer)
rel (of type character)
An arbitrary number of additional columns containing aesthetic or data
attributes can be part of the edf, so long as they follow the aforementioned
columns. Some examples are included in edge_aes()
create_edge_df(from, to, rel = NULL, ...)
from | 
 A vector of node ID values from which edges are outbound. The
vector length must equal that of the   | 
to | 
 A vector of node ID values to which edges are incoming. The vector
length must equal that of the   | 
rel | 
 An optional   | 
... | 
 One or more vectors for associated edge attributes. Can be some of   | 
An edge data frame (edf).
Other edge creation and removal: 
add_edge(),
add_edge_clone(),
add_edge_df(),
add_edges_from_table(),
add_edges_w_string(),
add_forward_edges_ws(),
add_reverse_edges_ws(),
copy_edge_attrs(),
delete_edge(),
delete_edges_ws(),
delete_loop_edges_ws(),
drop_edge_attrs(),
edge_data(),
join_edge_attrs(),
mutate_edge_attrs(),
mutate_edge_attrs_ws(),
recode_edge_attrs(),
rename_edge_attrs(),
rescale_edge_attrs(),
rev_edge_dir(),
rev_edge_dir_ws(),
set_edge_attr_to_display(),
set_edge_attrs(),
set_edge_attrs_ws()
# Create a simple edge data frame (edf) and
# view the results
edf <-
  create_edge_df(
    from = c(1, 2, 3),
    to = c(4, 3, 1),
    rel = "a")
# Display the edge data frame
edf
# Create an edf with additional edge
# attributes (where their classes will
# be inferred from the input vectors)
edf <-
  create_edge_df(
    from = c(1, 2, 3),
    to = c(4, 3, 1),
    rel = "a",
    length = c(50, 100, 250),
    color = "green",
    width = c(1, 5, 2))
# Display the edge data frame
edf
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.