This R6 class defines fields and methods for creating and storing NetInd_k
,
a matrix of friend indices (network IDs) of dim = (nobs x Kmax)
.
An R6Class
generator object
new(nobs, Kmax = 1)
Uses nobs
and Kmax
to instantiate an object of R6 class and pre-allocate memory
for the future network ID matrix.
makeNetInd.fromIDs(Net_str, IDs_str = NULL, sep = ' ')
Build the matrix of network IDs (NetInd_k
) from IDs string vector,
all friends of one observation i
are located in a string Net_str[i], with two distinct friend IDs of i
separated by character sep
. If IDs_str
is NULL it is assumed that the friends in Net_str are
actual row numbers in 1:nobs
, otherwise IDs from Net_str will be used for looking up the observation row numbers in IDs_str
.
make.nF(NetInd_k = self$NetInd_k, nobs = self$nobs, Kmax = self$Kmax)
This method calculates the integer number of
friends for each row of the network ID matrix (self$NetInd_k
). The result is assigned to a field self$nF
and
is returned invisibly.
mat.nF(nFnode)
nFnode
- the character name for the number of friends variable that is assigned as a column
name to a single column matrix in self$nF
.
new()
NetIndClass$new(nobs, Kmax = 1)
makeNetInd.fromIDs()
NetIndClass$makeNetInd.fromIDs(Net_str, IDs_str = NULL, sep = " ")
make.nF()
NetIndClass$make.nF(
NetInd_k = self$NetInd_k,
nobs = self$nobs,
Kmax = self$Kmax
)
mat.nF()
NetIndClass$mat.nF(nFnode)
clone()
The objects of this class are cloneable with this method.
NetIndClass$clone(deep = FALSE)
deep
Whether to make a deep clone.
NetInd - Matrix of friend indices (network IDs) of dim = (nobs x Kmax)
(Active Binding).
nF - Vector of integers, where nF[i]
is the integer number of friends (0 to Kmax
) for observation i
.
nobs - Number of observations
Kmax - Maximum number of friends for any observation.