powered by
Produces the same result as applying sum(x == 0) to each row or column.
sum(x == 0)
colZeros(x)rowZeros(x)
rowZeros(x)
a base::matrix or Matrix::Matrix object.
mt <- Matrix::rsparsematrix(100, 100, 0.01) colZeros(mt) apply(mt, 2, function(x) sum(x == 0)) # the same
Run the code above in your browser using DataLab