yearZero: yearZero - examine listed variables for zeros and NAs

View source: R/cpuefuncs.r

yearZeroR Documentation

yearZero - examine listed variables for zeros and NAs

Description

yearZero - examines an input data.frame of matrix in the variables listed in the parameter 'label' and counts the zeros, NAs, and those >0. It counts these relative to a 'Year' variable, or any grouping variable identified using the 'years' parameter.

Usage

yearZero(indat, years = "Year", label = c("catch_kg", "Effort"))

Arguments

indat

the data.frame or matrix to be examined

years

the grouping variable for counts to be compared across, defaults to 'Year'

label

the collection of column names which are to be examined, defaults to c('catch_kg','Effort'), which is suitable for SESSF data sets.#'

Value

A matrix of the variables in 'label' with a column for each of Zeros, >0, and NAs, with a final column of the number of records per grouping variable value.

Examples

## Not run: 
 insps <- matrix(runif(30),nrow=15,ncol=2)
 insps[trunc(runif(7)*30)+1] <- 0
 insps[trunc(runif(7)*30)+1] <- NA
 insps <- cbind(sort(rep(2000:2004,3)),insps)
 colnames(insps) <- c("Year","catch_kg","Effort")
 print(round(insps,4))
 yearZero(insps)

## End(Not run)

haddonm/rforcpue documentation built on Oct. 12, 2024, 11:55 p.m.