| bipartite_from_data_frame | R Documentation |
Create a two-mode network from a data.frame
bipartite_from_data_frame(d, type1, type2, attr = NULL, weighted = TRUE)
d |
data.frame |
type1 |
column name of mode 1 |
type2 |
column name of mode 2 |
attr |
named list of edge attributes |
weighted |
should a weighted graph be created if multiple edges occur |
Vertex identifiers are converted to character, so numeric and factor
columns are matched by their values. If weighted = TRUE, multiple edges are
merged, their count is stored in the edge attribute weight, numeric edge
attributes are summed and other edge attributes keep their first value.
two mode network as igraph object. The vertex attribute type is
TRUE for vertices from type1 and FALSE for vertices from type2.
David Schoch
library(igraph)
edges <- data.frame(mode1 = 1:5, mode2 = letters[1:5])
bipartite_from_data_frame(edges, "mode1", "mode2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.