simcausal (version 0.5.0)

NetInd.to.sparseAdjMat: Convert Network IDs Matrix into Sparse Adjacency Matrix

Description

Convert simcausal network ID matrix (NetInd_k) into a network represented by a sparse adjacency matrix.

Usage

NetInd.to.sparseAdjMat(NetInd_k, nF)

Arguments

NetInd_k
Matrix of network IDs of dimension (n=nrow(sparseAdjMat),Kmax), where each row i consists of the network IDs (row number of friends) of observation i. Remainders are filled with NAs.
nF
Integer vector of length n specifying the number of friends for each observation.

Value

  • Network represented as a sparse adjacency matrix (S4 class object dgCMatrix from package Matrix). NOTE: The friend IDs for observation i will be listed in column i (i.e, which(sparseAdjMat[,i]) are friends of i).

See Also

network; sparseAdjMat.to.igraph; igraph.to.sparseAdjMat; sparseAdjMat.to.NetInd;