calc_wqi: Calculate Water Quality Index (WQI)

calc_wqiR Documentation

Calculate Water Quality Index (WQI)

Description

Calculates a water quality index for a series of variables, values with upper limits and optionally lower limits using the method detailed in the CCME Water Quality Index 1.0 User's Manual.

Usage

calc_wqi(x, by = NULL, messages = getOption("wqbc.messages", default = TRUE))

Arguments

x

A data.frame to calculate the WQI for.

by

An optional character vector of the columns in x to calculate the WQI by.

messages

A flag indicating whether to print messages.

Details

The upper limits can be generated using the wqbc::calc_limits() function or can be provided by the user. If values are zero and detection limits are provided then the values are set to be the detection limits. This is important when the variable has lower limits because otherwise the excursion will be infinity and it will not be possible to calculate the WQI. In this case calc_wqi throws an informative error. Finally it is important to note that in order for the WQI to be calculated the data set must include four variables each with non-missing values on at least four separate days. In addition to calculating the WQI the function also generates 95% Lower and Upper bootstrap confidence intervals about the WQI. The confidence intervals are generated by first spreading the data into wide format where each row represents one date and then resampling the rows with replacement to generate 1,000 replicates. The confidence intervals are the 2.5% and 97.5% percentiles of the replicate WQIs.

See Also

wqbc::calc_limits()

Examples

data(ccme)
calc_wqi(ccme, messages = TRUE)
calc_wqi(ccme, by = "Date", messages = TRUE)

bcgov/wqindex documentation built on Feb. 17, 2024, 9:23 a.m.