colZeros: Number of zeros in columns and rows of large matrices

View source: R/utils.R

colZerosR Documentation

Number of zeros in columns and rows of large matrices

Description

Produce the same result as applying sum(x == 0) to each row or column.

Usage

colZeros(x)

rowZeros(x)

Arguments

x

a base::matrix or Matrix::Matrix object.

Value

an integer vector

Examples

mt <- Matrix::rsparsematrix(100, 100, 0.9)
colZeros(mt)
apply(mt, 2, function(x) sum(x == 0)) # the same

proxyC documentation built on Oct. 30, 2026, 9:08 a.m.