baytrends (version 1.1.0)

as.qw: Water-quality Data Conversion

Description

Converts data and meta data to a water-quality data (qw) object: various methods. From smwrQW package.

Usage

as.qw(values, remark.codes, value.codes, reporting.level, reporting.method,
  reporting.units, analyte.method, analyte.name, unique.code, value2)

# S4 method for numeric,character,character,numeric,character,character,character,character,character,missing as.qw(values, remark.codes, value.codes, reporting.level, reporting.method, reporting.units, analyte.method, analyte.name, unique.code, value2)

# S4 method for numeric,character,character,numeric,character,character,character,character,character,numeric as.qw(values, remark.codes, value.codes, reporting.level, reporting.method, reporting.units, analyte.method, analyte.name, unique.code, value2)

Arguments

values

the uncensored values and optionally the censored values.

remark.codes

the remarks codes: " " or "" indicated uncensored, "<" indicates left-censoring, ">" indicates right censoring. The special remark code "M" is created when the value is rounded to 0 by NWIS. In this case, the value is set to less than the reporting level if the reporting level is not the missing value NA, otherwise the value is set to missing NA and "M" is retained as the remark code. Other codes have a special meaning that can be modified by value.codes.

value.codes

special value qualifier codes. See Lorenz and others, 2014 for a description of these codes and the special remark.codes.

reporting.level

the reporting level associated with each value. Note that if the reporting level is not known, then NA_real_ should be used instead of using any arbitrary value.

reporting.method

the method used to compute the reporting level. These can be arbitrary codes, known only to the user.

reporting.units

the reporting units. A few defined units such as "mg/l" are recognized and used by the software.

analyte.method

the method used to compute the concentration. These can be arbitrary codes, known only to the user.

analyte.name

the name of the analyte. A few names are recongnized such as "chloride" and used by the software.

unique.code

an arbitrary code identifying unique instances of data. For data retreived from the US Geological Survey, this should be the 5-digit parameter code.

value2

for interval censored data, the upper value.

Value

An object of class "qw" that contains the numeric data in a two-column matrix and the meta data as additional slot information.

Details

Two methods for constructing water-quality data are defined in the current version. The first method works well for un-, left-, and right-censored data where the remark code and value can completely define the numeric values. The second method works for any censored data, including interval-censored data, where an upper and lower range of values are required. For the second method, values is the lower limit of the range and for left-censored data, may be either -Inf, NA, or 0. If -Inf, then the value is treated as strictly left-censored, otherwise, the lower limit is set to 0, which corresponds to the traditional interpretation of left-censored water-quality data. For the second method, value2 is the upper limit and for right-censored data will always be set to Inf.

References

Lorenz, D.L., in preparation