split {manynet} | R Documentation |
Splitting networks into lists
Description
These functions offer tools for splitting manynet-consistent objects (matrices, igraph, tidygraph, or network objects) into lists of networks.
Not all functions have methods available for all object classes. Below are the currently implemented S3 methods:
data.frame | diff_model | igraph | matrix | network | tbl_graph | |
to_components | 1 | 0 | 1 | 1 | 1 | 1 |
to_egos | 1 | 0 | 1 | 1 | 1 | 1 |
to_slices | 0 | 0 | 1 | 0 | 0 | 1 |
to_subgraphs | 0 | 0 | 1 | 0 | 1 | 1 |
to_waves | 1 | 1 | 1 | 0 | 0 | 1 |
Usage
to_egos(.data, max_dist = 1, min_dist = 0)
to_subgraphs(.data, attribute)
to_components(.data)
to_waves(.data, attribute = "wave", panels = NULL, cumulative = FALSE)
to_slices(.data, attribute = "time", slice = NULL)
Arguments
.data |
An object of a manynet-consistent class:
|
max_dist |
The maximum breadth of the neighbourhood. By default 1. |
min_dist |
The minimum breadth of the neighbourhood. By default 0. Increasing this to 1 excludes the ego, and 2 excludes ego's direct alters. |
attribute |
One or two attributes used to slice data. |
panels |
Would you like to select certain waves? NULL by default. That is, a list of networks for every available wave is returned. Users can also list specific waves they want to select. |
cumulative |
Whether to make wave ties cumulative. FALSE by default. That is, each wave is treated isolated. |
slice |
Character string or character list indicating the date(s) or integer(s) range used to slice data (e.g slice = c(1:2, 3:4)). |
Value
The returned object will be a list of network objects.
Functions
-
to_egos()
: Returns a list of ego (or focal) networks. -
to_subgraphs()
: Returns a list of subgraphs on some given node attribute. -
to_components()
: Returns a list of the components in a network. -
to_waves()
: Returns a network with some discrete observations over time into a list of those observations. -
to_slices()
: Returns a list of a network with some continuous time variable at some time slice(s).
See Also
Other modifications:
add_nodes()
,
add_ties()
,
as()
,
correlation
,
from
,
miss
,
reformat
,
to_levels
,
to_paths
,
to_project
,
to_scope
Examples
to_egos(ison_adolescents)
#autographs(to_egos(ison_adolescents,2))
ison_adolescents %>%
mutate(unicorn = sample(c("yes", "no"), 8,
replace = TRUE)) %>%
to_subgraphs(attribute = "unicorn")
to_components(ison_marvel_relationships)
ison_adolescents %>%
mutate_ties(wave = sample(1995:1998, 10, replace = TRUE)) %>%
to_waves(attribute = "wave")
ison_adolescents %>%
mutate_ties(time = 1:10, increment = 1) %>%
add_ties(c(1,2), list(time = 3, increment = -1)) %>%
to_slices(slice = 7)