Description Usage Arguments Details Value Examples
Convert a network data object to, possibly two, data frames: a data frame with an edge list with edge attributes (if any), and a data frame of vertexes with vertex attributes (if any). This is a generic function, see below for available methods.
1 2 3 4 5 6 7 |
object |
R object representing a network, see below for available methods |
... |
other arguments passed to/from other methods |
Currently there are methods for object
being in
one of the following classes: "network", "igraph".
The function first gets the graph edge list using the
appropriate function depending on the class of
object
(see below). Edge attributes, if any, are
then extracted using dumpAttr
and added to
it.
The vertex data frame is constructed with a vertex id as
a sequence of integer numbers. Details are
method-specific, see below. Vertex attributes are
extracted with dumpAttr
and added to this
data frame.
Method-specific notes:
For objects of class "network". Objects of this class
store the vertex ids as integer numbers. There is also an
attribute "vertex.names" which is always created when
using graph constructors provided in the package
network. asDF
adds "vertex.names" to the
vertex data frame as a normal attribute and does not use
it as a vertex id in the edge list.
The edge list is created using
as.matrix.network
function and
contains integer vertex ids.
Objects of class "igraph", as provided by the igraph package. Vertex ids in these objects integers starting from 1 (in igraph version prior to 0.6-0 vertex ids started from 0). However, it is also possible to provide a vertex attribute "name". It is added to the vertex data frame as a normal vertex attribute and is not used on the edge list data frame.
The edge list is created using
get.edgelist
function with argument
names
set to FALSE
so that integer vertex
ids are used.
List with two components:
edges
containing an edge list data frame at first two columns and edge attributes on further ones.
vertexes
with vertex id in the first
column, named id
and any vertex attributes in the
other columns.
1 2 3 4 5 6 7 |
List of 2
$ edges :'data.frame': 11 obs. of 4 variables:
..$ V1 : int [1:11] 2 3 4 5 6 8 10 11 14 12 ...
..$ V2 : int [1:11] 1 1 1 1 7 9 11 12 12 13 ...
..$ label: chr [1:11] "ba" "ca" "da" "ea" ...
..$ na : logi [1:11] FALSE FALSE FALSE FALSE FALSE FALSE ...
$ vertexes:'data.frame': 15 obs. of 4 variables:
..$ intergraph_id: int [1:15] 1 2 3 4 5 6 7 8 9 10 ...
..$ label : chr [1:15] "a" "b" "c" "d" ...
..$ na : logi [1:15] FALSE FALSE FALSE FALSE FALSE FALSE ...
..$ vertex.names : chr [1:15] "a" "b" "c" "d" ...
List of 2
$ edges :'data.frame': 11 obs. of 3 variables:
..$ V1 : num [1:11] 2 3 4 5 6 8 10 11 12 13 ...
..$ V2 : num [1:11] 1 1 1 1 7 9 11 12 13 14 ...
..$ label: chr [1:11] "ba" "ca" "da" "ea" ...
$ vertexes:'data.frame': 15 obs. of 2 variables:
..$ intergraph_id: int [1:15] 1 2 3 4 5 6 7 8 9 10 ...
..$ label : chr [1:15] "a" "b" "c" "d" ...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.