These functions allow users to add and delete tie attributes:

  • add_tie_attribute() and mutate_ties() offer ways to add a vector of values to a network as a tie attribute.

  • rename_ties() renames tie attributes.

  • join_ties() merges ties from two networks, adding a tie attribute identifying the newly added ties.

Note that while add_*()/delete_*() functions operate similarly as comparable {igraph} functions, mutate*(), bind*(), etc work like {tidyverse} or {dplyr}-style functions.

add_tie_attribute(.data, attr_name, vector)

mutate_ties(.data, ...)

rename_ties(.data, ...)

arrange_ties(.data, ...)

join_ties(.data, object2, attr_name)

select_ties(.data, ...)

summarise_ties(.data, ...)

Arguments

.data

An object of a {manynet}-consistent class:

  • adjacency or incidence matrix from {base} R

  • edgelist data.frame from {base} R or tbl/tbl_df from {tibble}

  • stocnet stocnet, from the {manynet} package

  • igraph igraph, from the {igraph} package

  • network network, from the {network} package

  • tidygraph tbl_graph, from the {tidygraph} package

attr_name

Character string naming a nodal attribute. The attribute itself may be a logical mark, numeric measure, or character membership vector.

vector

A vector of values for the new attribute.

...

Additional parameters and arguments passed on internally.

object2

A second object to copy nodes or ties from.

Value

A data object of the same class as the function was given.

Details

Not all functions have methods available for all object classes. Below are the currently implemented S3 methods for these functions:

                  data.frame default igraph stocnet tbl_graph
add_tie_attribute          *       *      *
arrange_ties                       *              *         *
mutate_ties                        *              *         *
rename_ties                *       *              *         *
select_ties                *       *              *         *
summarise_ties                     *                        *

If a method is not available for a particular class, but a default method is, the default method will attempt to coerce the object to a class for which a method is defined, and then coerce the output back to the original class. If no method is available for any class, an error will be thrown.

Examples

  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
#>