View source: R/make_edgelist.R
make_edgelist | R Documentation |
make_edgelist
makes an edge list from the supplied data frame. An edge list is a data frame with a "from" column, a "to" column, and, optionally, columns containing edge attributes, where each row is a directed edge.
make_edgelist(data, edge_attributes = NULL, from = "from", to = "to")
data |
a data set with a "from" column and a "to" column, where each row represents a directed edge. (See the |
edge_attributes |
an optional character vector of the names of columns in |
from |
the name of the column in |
to |
the name of the column in |
make_edgelist()
creates a pared down version of data
containing only the from
, to
, and edge_attributes
columns, and an added "edge_betweenness"
column containing edge betweennesses as produced by igraph::edge_betweenness()
.
A netlit_edglist
object, which is a data frame identical to data
except for the following:
all missing values will have been removed (with a warning if present in data
)
only the from
, to
, and edge_attributes
columns will be retained, with the from
and to
columns as the first two columns
an added column "edge_betweenness"
will be present containing the edge betweenness for each edge
the attribute "edge_attributes"
will contain the values supplied to edge_attributes
, if any
review
data("literature") edgelist <- make_edgelist(literature, edge_attributes = c("cites", "cites_empirical")) str(edgelist)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.