These functions reformat manynet-consistent data.
to_anti() reformats network data into its complement, where only ties not present in the original network
are included in the new network.
to_simplex() reformats complex network data, containing loops, to simplex network data, without any loops.
to_uniplex() reformats multiplex network data to a single type of tie.
If the format condition is not met,
for example to_undirected() is used on a network that is already undirected,
the network data is returned unaltered.
No warning is given so that these functions can be used to ensure conformance.
Unlike the as_*() group of functions,
these functions always return the same class as they are given,
only transforming these objects' properties.
to_anti(.data)
to_simplex(.data)
to_uniplex(.data, tie)An object of a {manynet}-consistent class:
matrix (adjacency or incidence) from {base} R
edgelist, a data frame from {base} R or tibble from {tibble}
igraph, from the {igraph} package
network, from the {network} package
tbl_graph, from the {tidygraph} package
Character string naming a tie attribute to retain from a graph.
A tidygraph object modified as explained in the function description, details, or section.
Not all functions have methods available for all object classes. Below are the currently implemented S3 methods:
Other modifications:
modif_correlation,
modif_direction,
modif_from,
modif_labels,
modif_levels,
modif_miss,
modif_paths,
modif_permutation,
modif_project,
modif_scope,
modif_split,
modif_weight
to_anti(ison_southern_women)
#> # A labelled, two-mode network of 18 nodes and 14 nodes and 163 ties
#>
#> ── Nodes
#> # A tibble: 32 × 2
#> type name
#> <lgl> <chr>
#> 1 FALSE Evelyn
#> 2 FALSE Laura
#> 3 FALSE Theresa
#> 4 FALSE Brenda
#> 5 FALSE Charlotte
#> 6 FALSE Frances
#> # ℹ 26 more rows
#>
#> ── Ties
#> # A tibble: 163 × 2
#> from to
#> <int> <int>
#> 1 1 25
#> 2 1 28
#> 3 1 29
#> 4 1 30
#> 5 1 31
#> 6 1 32
#> # ℹ 157 more rows
#>
as_tidygraph(create_filled(5)) |>
mutate_ties(type = sample(c("friend", "enemy"), 10, replace = TRUE)) |>
to_uniplex("friend")
#> ── # Filled network ────────────────────────────────────────────────────────────
#> # A undirected network of 5 nodes and 4 friend ties
#>
#> ── Ties
#> # A tibble: 4 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 1 5
#> 3 2 5
#> 4 4 5
#>