yearZero: yearZero - examine listed variables for zeros and NAs

Description Usage Arguments Value Examples

View source: R/cpuefuncs.r

Description

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

Usage

1
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

1
2
3
4
5
6
7
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)

haddonm/r4cpue documentation built on May 11, 2020, 1:31 a.m.