These functions offer tools for joining lists of manynet-consistent objects (matrices, igraph, tidygraph, or network objects) into a single object.
from_subgraphs() modifies a list of subgraphs into a single tidygraph.
from_egos() modifies a list of ego networks into a whole tidygraph
from_waves() modifies a list of network waves into a longitudinal tidygraph.
from_slices() modifies a list of time slices of a network into
a dynamic tidygraph.
from_ties() modifies a list of different ties into a multiplex tidygraph
from_subgraphs(netlist)
from_egos(netlist)
from_waves(netlist)
from_slices(netlist, remove.duplicates = FALSE)
from_ties(..., layer_names)A list of network, igraph, tidygraph, matrix, or edgelist objects.
Should duplicates be removed? By default FALSE. If TRUE, duplicated edges are removed.
Two or more tidygraph or stocnet objects to be merged, each representing a different set of ties to be combined into a single multiplex network.
A character vector of names for the different network objects, if not already named within the list.
A tidygraph object modified as explained in the function description, details, or section.
Other modifications:
modif_correlation,
modif_direction,
modif_labels,
modif_levels,
modif_miss,
modif_paths,
modif_permutation,
modif_plexity,
modif_project,
modif_scope,
modif_split,
modif_weight
ison_adolescents |>
mutate(unicorn = sample(c("yes", "no"), 8, replace = TRUE)) |>
to_subgraphs(attribute = "unicorn") |>
from_subgraphs()
#> # A labelled, undirected network of 8 nodes and 2 ties
#>
#> ── Nodes
#> # A tibble: 8 × 3
#> name unicorn.x unicorn.y
#> <chr> <chr> <chr>
#> 1 Betty no NA
#> 2 Alice no NA
#> 3 Dale no NA
#> 4 Carol no NA
#> 5 Sue NA yes
#> 6 Jane NA yes
#> # ℹ 2 more rows
#>
#> ── Ties
#> # A tibble: 2 × 2
#> from to
#> <int> <int>
#> 1 2 3
#> 2 5 7
#>
ison_adolescents |>
to_egos() |>
from_egos()
#> # A labelled, directed network of 8 nodes and 10 arcs
#>
#> ── Nodes
#> # A tibble: 8 × 1
#> name
#> <chr>
#> 1 Betty
#> 2 Sue
#> 3 Alice
#> 4 Jane
#> 5 Pam
#> 6 Carol
#> # ℹ 2 more rows
#>
#> ── Ties
#> # A tibble: 10 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 2 3
#> 3 2 7
#> 4 3 7
#> 5 2 5
#> 6 3 5
#> # ℹ 4 more rows
#>
ison_adolescents |>
mutate_ties(wave = sample(1:4, 10, replace = TRUE)) |>
to_waves(attribute = "wave") |>
from_waves()
#> # A longitudinal, labelled, directed network of 8 nodes and 10 arcs over 4
#> waves
#>
#> ── Nodes
#> # A tibble: 8 × 1
#> name
#> <chr>
#> 1 Sue
#> 2 Alice
#> 3 Betty
#> 4 Pam
#> 5 Jane
#> 6 Carol
#> # ℹ 2 more rows
#>
#> ── Ties
#> # A tibble: 10 × 3
#> from to wave
#> <int> <int> <int>
#> 1 1 2 1
#> 2 2 7 1
#> 3 3 1 2
#> 4 2 5 2
#> 5 1 7 2
#> 6 1 4 2
#> # ℹ 4 more rows
#>
ison_adolescents |>
mutate_ties(time = 1:10, increment = 1) |>
add_ties(c(1,2), list(time = 3, increment = -1)) |>
to_slices(slice = c(5,7)) |>
from_slices()
#> # A labelled, weighted, directed network of 5 nodes and 10 arcs
#>
#> ── Nodes
#> # A tibble: 5 × 1
#> name
#> <chr>
#> 1 Sue
#> 2 Alice
#> 3 Jane
#> 4 Dale
#> 5 Pam
#>
#> ── Ties
#> # A tibble: 10 × 3
#> from to weight
#> <int> <int> <dbl>
#> 1 1 2 1
#> 2 2 3 1
#> 3 1 4 1
#> 4 2 4 1
#> 5 1 2 1
#> 6 2 3 1
#> # ℹ 4 more rows
#>