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 8cbff4d UNW- 10 26 --
#> + 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 8cbff4d (vertex names):
#> [1] 7--9 3--8 3--4 2--3 1--3 5--6 2--5 2--6 4--9 8--9 7--8 9--10
#> [13] 5--8 1--5 7--10 3--5 5--9 4--5 6--7 3--6 1--7 1--2 3--9 4--8
#> [25] 3--10 2--4
#>
#> $`2`
#> IGRAPH 6f276c1 UNW- 18 75 --
#> + 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 6f276c1 (vertex names):
#> [1] 4 --16 13--16 6 --8 2 --7 11--12 11--16 10--13 7 --18 6 --18 1 --2
#> [11] 8 --16 5 --9 1 --3 9 --18 4 --10 2 --14 14--18 5 --11 6 --16 9 --14
#> [21] 16--17 3 --13 5 --15 6 --14 11--15 17--18 12--15 5 --14 6 --7 4 --13
#> [31] 15--17 2 --4 3 --9 12--18 4 --6 9 --11 7 --13 4 --14 14--15 3 --11
#> [41] 8 --18 10--11 10--17 11--14 1 --9 14--17 2 --9 6 --9 1 --16 2 --5
#> [51] 3 --15 2 --6 8 --9 3 --18 1 --10 7 --12 4 --11 8 --13 9 --17 10--12
#> [61] 1 --13 11--18 7 --15 8 --12 3 --14 12--14 2 --10 7 --14 9 --13 3 --10
#> + ... omitted several edges
#>
#> $`3`
#> IGRAPH 82ecac1 UNW- 10 20 --
#> + 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 82ecac1 (vertex names):
#> [1] 6--9 3--6 4--5 7--10 5--8 8--9 5--6 3--7 3--10 6--10 1--8 2--5
#> [13] 1--6 2--6 1--7 2--10 1--3 1--9 3--8 1--5
#>