Check input data for IPI

chkinp(stations, phab, qa = TRUE, allerr = TRUE, log = FALSE)

Arguments

stations

data.frame of input station data

phab

data.frame of input physical habitat data

qa

logical value passed from IPI to suppress error checks on relevant metrics

allerr

logical indicating if all errors are returned or the first encountered

log

logical indicating if errors are printed to log in the workign directory, applies only if allerr = TRUE

Value

An error message is returned if the input data are not correctly formatted. If a dataset has multiple errors, only the first is returned.

Details

This function checks the following:

No duplicate station rows in stations

All stations in stations are in phab and the converse

All required fields in stations and phab

All required PHAB variables are present in the variable field of phab for each station and sample date. An exception is made for XC, PCT_POOL, and XFC_ALG, which are not necessary for the IPI but are used for optional quality assurance checks.

No duplicate results for PHAB variables at each station and sample date

All input variables for stations and phab are non-negative, excluding elevation variables in stations which may be negative if below sea level (i.e., some locations in southeast California). The variable XBKF_W in phab must also be greater than zero.

Examples

chkinp(stations, phab)
#> NULL