These functions offer ways to manipulate network-level data constants or variables that are not tied to a particular node or tie. They include:

  • bind_globals() adds rows of global variables to the network.

  • mutate_globals() changes the columns of the global variables table. Where the network holds no global variables yet, it creates the table. Where it holds one already, it changes that table's columns rather than adding to it, so use bind_globals() to add another global variable.

  • rename_globals() renames columns in the global variables table.

  • select_globals() selects columns in the global variables table.

  • filter_globals() subsets rows of the global variables table.

  • arrange_globals() orders rows of the global variables table.

  • delete_globals() drops the global variables table from the network.

It expects three columns for the variable to which the change applies, which should be called 'var', the time of the change, which should be called 'time', and the new value to be applied, which should be called 'value'.

mutate_globals(.data, ...)

rename_globals(.data, ...)

select_globals(.data, ...)

bind_globals(.data, globals)

filter_globals(.data, ...)

arrange_globals(.data, ...)

delete_globals(.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

...

Additional parameters and arguments passed on internally.

globals

A data frame of global variables to bind on. It should hold a column var naming the variable, a column value holding its value, and, where the variable changes over time, a column time.

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 stocnet
mutate_globals                  *       *
rename_globals          *       *       *
select_globals          *       *       *

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

as_stocnet(ison_algebra) |> 
   mutate_globals(time = 2, var = "active", value = FALSE)
#> 
#> ── # M182 Algebra Class ────────────────────────────────────────────────────────
#> # A multiplex, weighted, directed network of 16 nodes and 129 social arcs, 88
#> task arcs, and 62 friendship arcs
#> 
#> ── Globals 
#> # A tibble: 1 × 3
#>    time var         value
#>   <dbl> <chr>      <list>
#> 1     2 active FALSE<lgl>
#> 
#> ── Ties 
#> # A tibble: 279 × 4
#>    from    to weight layer 
#>   <int> <int>  <dbl> <chr> 
#> 1     1     5   1.2  social
#> 2     1     5   0.3  tasks 
#> 3     1     8   0.15 social
#> 4     1     9   2.85 social
#> 5     1     9   0.3  tasks 
#> 6     1    10   6.45 social
#> # ℹ 273 more rows
#> 
as_stocnet(ison_algebra) |>
   bind_globals(data.frame(time = 1:2, var = "budget", value = c(10, 20)))
as_stocnet(ison_algebra) |>
   bind_globals(data.frame(time = 1:2, var = "budget", value = c(10, 20))) |>
   filter_globals(time == 1)
#> ── # M182 Algebra Class ────────────────────────────────────────────────────────
#> # A multiplex, weighted, directed network of 16 nodes and 129 social arcs, 88
#> task arcs, and 62 friendship arcs
#> 
#> ── Globals 
#> # A tibble: 1 × 3
#>    time var      value
#>   <int> <chr>   <list>
#> 1     1 budget 10<dbl>
#> 
#> ── Ties 
#> # A tibble: 279 × 4
#>    from    to weight layer 
#>   <int> <int>  <dbl> <chr> 
#> 1     1     5   1.2  social
#> 2     1     5   0.3  tasks 
#> 3     1     8   0.15 social
#> 4     1     9   2.85 social
#> 5     1     9   0.3  tasks 
#> 6     1    10   6.45 social
#> # ℹ 273 more rows
#>