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(netlist, netnames)
A list of network, igraph, tidygraph, matrix, or edgelist objects.
Should duplicates be removed? By default FALSE. If TRUE, duplicated edges are removed.
A character vector of names for the different network objects, if not already named within the list.
A tidygraph object combining the list of network data.
ison_adolescents %>%
mutate(unicorn = sample(c("yes", "no"), 8, replace = TRUE)) %>%
to_subgraphs(attribute = "unicorn") %>%
from_subgraphs()
#> Joining with `by = join_by(name, unicorn)`
#> # A labelled, undirected network with 8 nodes and 5 ties
#> # A tibble: 8 × 2
#> name unicorn
#> <chr> <chr>
#> 1 Betty yes
#> 2 Sue yes
#> 3 Jane yes
#> 4 Dale yes
#> 5 Carol yes
#> 6 Tina yes
#> # ℹ 2 more rows
#> # A tibble: 5 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 2 4
#> 3 3 4
#> 4 5 6
#> 5 7 8
ison_adolescents %>%
to_egos() %>%
from_egos()
#> # A labelled, directed network with 8 nodes and 10 arcs
#> # A tibble: 8 × 1
#> name
#> <chr>
#> 1 Betty
#> 2 Sue
#> 3 Alice
#> 4 Jane
#> 5 Pam
#> 6 Carol
#> # ℹ 2 more rows
#> # 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 with 8 nodes and 10 arcs
#> # A tibble: 8 × 1
#> name
#> <chr>
#> 1 Betty
#> 2 Sue
#> 3 Pam
#> 4 Alice
#> 5 Jane
#> 6 Carol
#> # ℹ 2 more rows
#> # A tibble: 10 × 3
#> from to wave
#> <int> <int> <int>
#> 1 1 2 3
#> 2 2 3 3
#> 3 3 6 3
#> 4 2 4 4
#> 5 4 3 4
#> 6 4 5 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, multiplex, weighted, directed network with 5 nodes and 10 arcs
#> # A tibble: 5 × 1
#> name
#> <chr>
#> 1 Sue
#> 2 Alice
#> 3 Jane
#> 4 Dale
#> 5 Pam
#> # 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