Learn R Programming

bunsen (version 0.1.1)

firstZeroIndex: First zero index for each column of a matrix

Description

For each column, returns the 1-based index of the first zero value. If a column contains no zeros, returns NA for that column.

Usage

firstZeroIndex(mat)

Value

IntegerVector of length ncol(mat) with 1-based indices or NA.

Arguments

mat

NumericMatrix

Examples

Run this code
m <- matrix(c(1, 0, 2,0, 3, 1),nrow = 3, ncol = 2)
firstZeroIndex(m)

Run the code above in your browser using DataLab