nonzero: Retrieve the indices of non-zero elements in sparse matrices

View source: R/utils.R

nonzeroR Documentation

Retrieve the indices of non-zero elements in sparse matrices

Description

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

Usage

nonzero(x)

Arguments

x

A sparse matrix of class dgCMatrix

Value

A two-column matrix

Author(s)

Samuel Wieczorek

Examples

library(Matrix)
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)


prostarproteomics/DAPAR documentation built on March 28, 2024, 4:44 a.m.