Convert conflictNet object to a statnet network object
prep_for_statnet.Rd
Convert conflictNet object to a statnet network object
Examples
# load data
data(icews)
# cross-sectional case
icews_10 <- icews[icews$year==2010,]
# create netify object
dvars = c( 'matlCoop', 'verbConf', 'matlConf' )
nvars = c( 'i_polity2','i_log_gdp', 'i_log_pop' )
verbCoop_net = netify(
icews_10,
actor1='i', actor2='j',
symmetric=FALSE,
weight='verbCoop',
dyad_vars = dvars,
dyad_vars_symmetric=rep(FALSE, length(dvars)),
nodal_vars = nvars )
# convert to a statnet network object
ntwk <- prep_for_statnet(verbCoop_net)
ntwk
#> Network attributes:
#> vertices = 152
#> directed = TRUE
#> hyper = FALSE
#> loops = FALSE
#> multiple = FALSE
#> bipartite = FALSE
#> verbCoop: 152x152 matrix
#> matlCoop: 152x152 matrix
#> verbConf: 152x152 matrix
#> matlConf: 152x152 matrix
#> total edges= 9976
#> missing edges= 0
#> non-missing edges= 9976
#>
#> Vertex attribute names:
#> i_log_gdp i_log_pop i_polity2 vertex.names
#>
#> Edge attribute names not shown
# longitudinal case
verbCoop_longit_net = netify(
icews,
actor1='i', actor2='j', time='year',
symmetric=FALSE,
weight='verbCoop',
dyad_vars = dvars,
dyad_vars_symmetric=rep(FALSE, length(dvars)),
nodal_vars = nvars )
# convert to a statnet network object
ntwk_longit <- prep_for_statnet(verbCoop_longit_net)
# output in the longitudinal case is
# a list of statnet network objects
class(ntwk_longit)
#> [1] "list"
names(ntwk_longit)
#> [1] "2002" "2003" "2004" "2005" "2006" "2007" "2008" "2009" "2010" "2011"
#> [11] "2012" "2013" "2014"
ntwk_longit[['2002']]
#> Network attributes:
#> vertices = 152
#> directed = TRUE
#> hyper = FALSE
#> loops = FALSE
#> multiple = FALSE
#> bipartite = FALSE
#> verbCoop: 152x152 matrix
#> matlCoop: 152x152 matrix
#> verbConf: 152x152 matrix
#> matlConf: 152x152 matrix
#> total edges= 8692
#> missing edges= 0
#> non-missing edges= 8692
#>
#> Vertex attribute names:
#> i_log_gdp i_log_pop i_polity2 vertex.names
#>
#> Edge attribute names not shown