remove.ids {CDatanet} | R Documentation |
Removing Identifiers with NA from Adjacency Matrices Optimally
Description
The remove.ids
function removes identifiers with missing values (NA) from adjacency matrices in an optimal way.
Multiple combinations of rows and columns can be deleted to eliminate NAs, but this function ensures that the smallest
number of rows and columns are removed to retain as much data as possible.
Usage
remove.ids(network, ncores = 1L)
Arguments
network |
A list of adjacency matrices to process. |
ncores |
The number of cores to use for parallel computation. |
Value
A list containing:
- network
A list of adjacency matrices without missing values.
- id
A list of vectors indicating the indices of retained rows and columns for each matrix.
Examples
# Example 1: Small adjacency matrix
A <- matrix(1:25, 5)
A[1, 1] <- NA
A[4, 2] <- NA
remove.ids(A)
# Example 2: Larger adjacency matrix with multiple NAs
B <- matrix(1:100, 10)
B[1, 1] <- NA
B[4, 2] <- NA
B[2, 4] <- NA
B[, 8] <- NA
remove.ids(B)
[Package CDatanet version 2.2.1 Index]