cssTools2sna: Convert a CSS in 'cssTools' Format to a CSS in 'sna' Format

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/cssTools2sna.R

Description

Converts a CSS in cssTools package format to a CSS in sna package format.

Usage

1

Arguments

d

A CSS in cssTools package format.

Details

In cssTools package, a CSS d is coded in a three dimensional array such that d[,,i] is the i-th slice. In sna package, the same object is coded in a three dimensional array such that d[i,,] is the i-th slice. The cssTools2sna function transforms cssTools format to sna format.

Value

The same CSS coded in sna format.

Author(s)

Deniz Yenigun, Gunes Ertan, Michael Siciliano

See Also

sna2cssTools

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Consider the example in Siciliano et. al. (2012),
# a network with five actors A, B, C, D, E
sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5)
sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5)
sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5)
sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5)
sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5)
d=array(dim=c(5,5,5))
d[,,1]=sA
d[,,2]=sB
d[,,3]=sC
d[,,4]=sD
d[,,5]=sE

# Here d is coded in cssTools package format
# Switching between sna and cssTools formats
e=cssTools2sna(d)
f=sna2cssTools(e)

cssTools documentation built on May 2, 2019, 1:26 p.m.