These functions convert an egor
object into a list of network
or igraph
objects.
By default ego itself is not included in the created objects, there is
a parameter (include.egor) that allows for including ego.
as_igraph(
x,
directed = FALSE,
include.ego = FALSE,
ego.attrs = NULL,
ego.alter.weights = NULL,
graph.attrs = ".egoID"
)
# S3 method for nested_egor
as_igraph(
x,
directed = FALSE,
include.ego = FALSE,
ego.attrs = NULL,
ego.alter.weights = NULL,
graph.attrs = ".egoID"
)
# S3 method for egor
as.igraph(
x,
directed = FALSE,
include.ego = FALSE,
ego.attrs = NULL,
ego.alter.weights = NULL,
graph.attrs = ".egoID"
)
as_network(
x,
directed = FALSE,
include.ego = FALSE,
ego.attrs = NULL,
ego.alter.weights = NULL,
graph.attrs = ".egoID"
)
# S3 method for egor
as.network(
x,
directed = FALSE,
include.ego = FALSE,
ego.attrs = NULL,
ego.alter.weights = NULL,
graph.attrs = ".egoID"
)
An egor
object.
Logical, indicating if alter-alter relations are directed.
Logical.
Should ego be included?
Vector of names (character) or indices (numeric) of ego
variables that should be carried over to the network/
igraph objects. This is ignored, when include.ego = FALSE
(default).
Vector of names (character) or indices (numeric) of alter variables that should be carried over to the the network/ igraph objects, as edge attributes of the ego-alter relations. This is ignored, when `include.ego = FALSE`` (default).
Vector of names (character) or indices (numeric) of
ego variables that are supposed to be carried over to the igraph object
as graph attributes or the network object as network attributes. By
default .egoID
is carried over.
The names of the variables specified in ego.attr and ego.alter.attr need to be the same as the names of corresponding alter attributes, in order for those variables to be merged successfully in the resulting network/ igraph object (see example).
e <- make_egor(3, 22)
as_igraph(e)
#> $`1`
#> IGRAPH c5a8232 UNW- 10 23 --
#> + attr: .egoID (g/n), name (v/c), sex (v/c), age (v/c), age.years
#> | (v/n), country (v/c), income (v/n), weight (e/n)
#> + edges from c5a8232 (vertex names):
#> [1] 2--8 7--9 2--3 2--4 5--8 3--7 4--7 1--8 6--10 3--6 2--6 5--9
#> [13] 1--10 1--2 3--10 9--10 3--5 3--9 1--9 3--8 8--10 5--6 5--10
#>
#> $`2`
#> IGRAPH aaba9c7 UNW- 8 10 --
#> + attr: .egoID (g/n), name (v/c), sex (v/c), age (v/c), age.years
#> | (v/n), country (v/c), income (v/n), weight (e/n)
#> + edges from aaba9c7 (vertex names):
#> [1] 1--7 6--7 2--5 1--2 3--5 1--5 2--4 1--6 1--8 5--8
#>
#> $`3`
#> IGRAPH 7de20e3 UNW- 14 49 --
#> + attr: .egoID (g/n), name (v/c), sex (v/c), age (v/c), age.years
#> | (v/n), country (v/c), income (v/n), weight (e/n)
#> + edges from 7de20e3 (vertex names):
#> [1] 3 --13 2 --9 8 --13 2 --14 4 --12 2 --13 7 --11 9 --10 1 --5 2 --6
#> [11] 11--14 1 --10 9 --11 5 --8 8 --11 10--13 4 --10 5 --6 1 --6 6 --14
#> [21] 11--12 10--14 7 --12 2 --8 1 --11 6 --12 1 --14 10--12 7 --13 7 --8
#> [31] 4 --9 7 --14 5 --13 3 --5 3 --11 11--13 4 --5 1 --7 3 --6 6 --8
#> [41] 12--13 1 --4 8 --9 2 --3 2 --12 4 --11 3 --9 2 --7 1 --12
#>