countzeros: countzeros used in apply to count the number of zeros in a...

View source: R/mqmf_utils.r

countzerosR Documentation

countzeros used in apply to count the number of zeros in a vector

Description

countzeros used in the base function 'apply', or 'tapply' to count the number of zeros in a vector

Usage

countzeros(invect)

Arguments

invect

vector of values

Value

A single value of zero or the number of zeros

Examples

x <- matrix(trunc(runif(20)*10),nrow=4,ncol=5)
print(x)
apply(x,1,countzeros) # count by rows
apply(x,2,countzeros) # count by columns

MQMF documentation built on Sept. 8, 2023, 5:14 p.m.