These functions allow users to add and delete ties:
add_ties() adds additional ties to network data
delete_ties() deletes ties from network data
filter_ties() subsets ties based on some tie attribute-related logical statement.
While add_*()/delete_*() functions operate similarly as comparable {igraph} functions,
filter*(), etc work like {tidyverse} or {dplyr}-style functions.
add_ties(.data, ties, attr_list = NULL)
delete_ties(.data, ties)
filter_ties(.data, ...)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
The number of ties to be added or an even list of ties.
A list of attributes to be added to the new ties.
Additional parameters and arguments passed on internally.
A data object of the same class as the function was given.
Not all functions have methods available for all object classes. Below are the currently implemented S3 methods:
Other ties:
manip_ties_attr,
modif_direction,
modif_weight
Other manipulations:
manip_changes,
manip_info,
manip_nodes_attr,
manip_nodes_num,
manip_ties_attr
other <- create_filled(4) |> mutate(name = c("A", "B", "C", "D"))
mutate_ties(other, form = 1:6) |> filter_ties(form < 4)
#>
#> ── # Filled network ────────────────────────────────────────────────────────────
#> # A labelled, multiplex, undirected network of 4 nodes and 3 ties
#>
#> ── Nodes
#> # A tibble: 4 × 1
#> name
#> <chr>
#> 1 A
#> 2 B
#> 3 C
#> 4 D
#>
#> ── Ties
#> # A tibble: 3 × 3
#> from to form
#> <int> <int> <int>
#> 1 1 2 1
#> 2 1 3 2
#> 3 1 4 3
#>
add_tie_attribute(other, "weight", c(1, 2, 2, 2, 1, 2))
#> ── # Filled network ────────────────────────────────────────────────────────────
#> # A labelled, weighted, undirected network of 4 nodes and 6 ties
#>
#> ── Nodes
#> # A tibble: 4 × 1
#> name
#> <chr>
#> 1 A
#> 2 B
#> 3 C
#> 4 D
#>
#> ── Ties
#> # A tibble: 6 × 3
#> from to weight
#> <int> <int> <dbl>
#> 1 1 2 1
#> 2 1 3 2
#> 3 1 4 2
#> 4 2 3 2
#> 5 2 4 1
#> 6 3 4 2
#>
ison_adolescents |> add_ties(c("Betty","Tina"))
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A labelled, undirected network of 8 adolescents and 11 friendships ties
#>
#> ── Nodes
#> # A tibble: 8 × 1
#> name
#> <chr>
#> 1 Betty
#> 2 Sue
#> 3 Alice
#> 4 Jane
#> 5 Dale
#> 6 Pam
#> # ℹ 2 more rows
#>
#> ── Ties
#> # A tibble: 11 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 2 3
#> 3 3 4
#> 4 2 5
#> 5 3 5
#> 6 4 5
#> # ℹ 5 more rows
#>
delete_ties(ison_adolescents, 3)
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A labelled, undirected network of 8 adolescents and 9 friendships ties
#>
#> ── Nodes
#> # A tibble: 8 × 1
#> name
#> <chr>
#> 1 Betty
#> 2 Sue
#> 3 Alice
#> 4 Jane
#> 5 Dale
#> 6 Pam
#> # ℹ 2 more rows
#>
#> ── Ties
#> # A tibble: 9 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 2 3
#> 3 2 5
#> 4 3 5
#> 5 4 5
#> 6 2 6
#> # ℹ 3 more rows
#>
delete_ties(ison_adolescents, "Alice|Sue")
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A labelled, undirected network of 8 adolescents and 9 friendships ties
#>
#> ── Nodes
#> # A tibble: 8 × 1
#> name
#> <chr>
#> 1 Betty
#> 2 Sue
#> 3 Alice
#> 4 Jane
#> 5 Dale
#> 6 Pam
#> # ℹ 2 more rows
#>
#> ── Ties
#> # A tibble: 9 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 3 4
#> 3 2 5
#> 4 3 5
#> 5 4 5
#> 6 2 6
#> # ℹ 3 more rows
#>