These functions offer ways to modify data held about how nodes change over time. They include:
bind_changes() adds a table of changes to the nodes of a network.
mutate_changes() can be used to update network changes.
filter_changes() is used to subset network changes.
gather_changes() is similar to filter_changes(),
but collects the cumulative changes up to a time point.
apply_changes() applies the changes collected up to a time point
to a network, removing the changes.
An example of when this might be useful is to track change in the composition of a network (when nodes are present or absent over time), though the function can flexibly accommodate changes in other nodal attributes.
delete_changes(.data)
mutate_changes(.data, ...)
bind_changes(.data, changes, var, ...)
filter_changes(.data, ..., .by = NULL)
select_changes(.data, ..., .by = NULL)
arrange_changes(.data, ...)
rename_changes(.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.
A data frame containing the changes to be added.
This should have columns time, node (labelled),
var (referencing an existing nodal attribute),
and value (which can be of any class).
A character string specifying the nodal variable to which the changes apply,
if not already specified in the changes data frame. This is only used
when the changes data frame does not already have a var column, and is ignored otherwise.
An attribute name to join objects by. By default, NULL.
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 for these functions:
data.frame default igraph stocnet tbl_graph
arrange_changes * * *
bind_changes * * * *
delete_changes * * *
filter_changes * * *
mutate_changes * * *
rename_changes * * * *
select_changes * * * *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.
Other changes:
mark_format_change
Other manipulations:
manip_globals,
manip_info,
manip_nodes_attr,
manip_nodes_num,
manip_ties_attr,
manip_ties_num
filter_changes(fict_starwars, node == "Anakin")
#>
#> ── # Star Wars network data ────────────────────────────────────────────────────
#> # A longitudinal, labelled, complex, weighted, directed network of 110
#> characters and 563 interaction arcs over 7 waves
#>
#> ── Nodes
#> # A tibble: 110 × 12
#> label species homeworld sex height hair_color eye_color skin_color
#> <chr> <chr> <chr> <chr> <int> <chr> <chr> <chr>
#> 1 Admiral Ackbar Mon Ca… Mon Cala male 180 none orange brown mot…
#> 2 Admiral Statura Human Garel male 172 black brown light
#> 3 Anakin Human Tatooine male 188 blond blue fair
#> 4 Bail Organa Human Alderaan male 191 black brown tan
#> # ℹ 106 more rows
#> # ℹ 4 more variables: birth_year <dbl>, mass <dbl>, faction <chr>, active <lgl>
#>
#> ── Changes
#> # A tibble: 8 × 4
#> time node var value
#> <int> <int> <chr> <list>
#> 1 3 3 faction Sith<chr>
#> 2 3 3 height 202<chr>
#> 3 3 3 mass 136<chr>
#> 4 3 3 hair_color none<chr>
#> # ℹ 4 more rows
#>
#> ── Ties
#> # A tibble: 563 × 4
#> from to weight time
#> <int> <int> <int> <int>
#> 1 80 73 11 1
#> 2 80 79 14 1
#> 3 80 3 16 1
#> 4 80 106 3 1
#> # ℹ 559 more rows
#>
select_changes(fict_starwars, node)
#> ── # Star Wars network data ────────────────────────────────────────────────────
#> Warning: Unknown or uninitialised column: `time`.
#> Warning: Unknown or uninitialised column: `time`.
#> Warning: Unknown or uninitialised column: `time`.
#> # A longitudinal, labelled, complex, weighted, directed network of 110
#> characters and 563 interaction arcs over 7 waves
#>
#> ── Nodes
#> # A tibble: 110 × 12
#> label species homeworld sex height hair_color eye_color skin_color
#> <chr> <chr> <chr> <chr> <int> <chr> <chr> <chr>
#> 1 Admiral Ackbar Mon Ca… Mon Cala male 180 none orange brown mot…
#> 2 Admiral Statura Human Garel male 172 black brown light
#> 3 Anakin Human Tatooine male 188 blond blue fair
#> 4 Bail Organa Human Alderaan male 191 black brown tan
#> # ℹ 106 more rows
#> # ℹ 4 more variables: birth_year <dbl>, mass <dbl>, faction <chr>, active <lgl>
#>
#> ── Changes
#> # A tibble: 184 × 1
#> node
#> <int>
#> 1 7
#> 2 10
#> 3 11
#> 4 13
#> # ℹ 180 more rows
#>
#> ── Ties
#> # A tibble: 563 × 4
#> from to weight time
#> <int> <int> <int> <int>
#> 1 80 73 11 1
#> 2 80 79 14 1
#> 3 80 3 16 1
#> 4 80 106 3 1
#> # ℹ 559 more rows
#>