Longitudinal variants of get_adjacency()
which returns a three-dimensional array
get_adjacency_array.Rd
get_adjacency_array
takes in a dyadic dataset
and outputs an three-dimensional array with the first two dimensions corresponding to actors
and the third dimension corresponding to time. This function should be used only
when the actor composition remains constant throughout time.
Usage
get_adjacency_array(
dyad_data,
actor1 = NULL,
actor2 = NULL,
time = NULL,
symmetric = TRUE,
mode = "unipartite",
weight = NULL,
sum_dyads = FALSE,
diag_to_NA = TRUE,
missing_to_zero = TRUE
)
Arguments
- dyad_data
a dyadic dataframe (or a tibble)
- actor1
character: name of the actor 1 variable in dyad_data
- actor2
character: name of the actor 2 variable in dyad_data
- time
character: name of the time variable in dyad_data, the values of the time variable itself should be numeric
- symmetric
logical: whether ties are symmetric, default is TRUE
- mode
character: whether the network is unipartite or bipartite, default is unipartite
- weight
character: name of the weighted edges variable, default is NULL
- sum_dyads
logical: whether to sum up the
weight
value when there exists repeating dyads- diag_to_NA
logical: whether diagonals should be set to NA, default is TRUE
- missing_to_zero
logical: whether missing values should be set to zero, default is TRUE
Examples
# load example directed event data from ICEWS
# this data comes in the form of a dyadic
# dataframe where all dyad pairs are listed
data(icews)
# generate a longitudinal, directed and weighted network
# where the weights are matlConf
icews_matlConf <- get_adjacency_array(
dyad_data=icews,
actor1='i', actor2='j', time='year',
symmetric=FALSE, weight='matlConf' )