manip_from: Joining lists of networks, graphs, and matrices

manip_fromR Documentation

Joining lists of networks, graphs, and matrices

Description

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

Usage

from_subgraphs(netlist)

from_egos(netlist)

from_waves(netlist)

from_slices(netlist, remove.duplicates = FALSE)

from_ties(netlist, netnames)

Arguments

netlist

A list of network, igraph, tidygraph, matrix, or edgelist objects.

remove.duplicates

Should duplicates be removed? By default FALSE. If TRUE, duplicated edges are removed.

netnames

A character vector of names for the different network objects, if not already named within the list.

Value

A tidygraph object combining the list of network data.

See Also

Other modifications: manip_as, manip_correlation, manip_deformat, manip_levels, manip_miss, manip_nodes, manip_paths, manip_permutation, manip_preformat, manip_project, manip_reformat, manip_scope, manip_split, manip_ties

Examples

ison_adolescents %>%
  mutate(unicorn = sample(c("yes", "no"), 8, replace = TRUE)) %>%
  to_subgraphs(attribute = "unicorn") %>%
  from_subgraphs()
ison_adolescents %>%
  to_egos() %>%
  from_egos()
ison_adolescents %>%
  mutate_ties(wave = sample(1:4, 10, replace = TRUE)) %>%
  to_waves(attribute = "wave") %>%
  from_waves()
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()

manynet documentation built on June 23, 2025, 9:07 a.m.