nonzero | R Documentation |
This function retrieves the indices of non-zero elements in sparse matrices
of class dgCMatrix from package Matrix. This function is largely inspired
from the package RINGO
.
nonzero(x)
x |
A sparse matrix of class dgCMatrix |
A two-column matrix
Samuel Wieczorek
mat <- Matrix(c(0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1),
nrow = 5, byrow = TRUE, sparse = TRUE
)
res <- nonzero(mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.