ProcessObs: Process Observations

Description Usage Arguments Details Value Author(s) See Also

View source: R/ProcessObs.R

Description

This function processes measurements from observation sites in a monitoring network.

Usage

1
2
ProcessObs(observations, parameters, detection.limits = NULL,
  date.fmt = "%Y-%m-%d")

Arguments

observations

data.frame. Observed data records, see ‘Details’ section.

parameters

data.frame. Parameter descriptions, see ‘Details’ section.

detection.limits

data.frame. Detection limits, see ‘Details’ section.

date.fmt

character. Date format used to convert character strings to Date class.

Details

The observations, parameters, and detection.limits data tables are composed of character-class components.

Required columns in the observations data table include: Site_id, a unique site identifier; Site_name, a local site name; and Date, the measurement date. Measured values are checked for an optional character code in the first digit of each character string value. Character codes are identified using the following criteria: <, below reporting level; E, estimated value; V, contaminated; and U, undetectable. Values are stripped of their character code and converted to numeric class. A warning is given if the character code is not recognized and its value set to NA. Measured values with character codes of V and U are also set to NA.

Required columns in the parameters data table include: Parameter_id, a unique parameter identifier; Parameter_name, the common parameter name; Units, the units associated with the measured parameter values; and sd, a column name in observations data table where the parameters standard deviation values are located.

A required column in the detection.limits data table is Date, the date when the detection limit was first implemented. Detection limit values are located in subsequent columns; a unique parameter identifier is specified for each of these column names.

A measured value is converted to censored data under the following conditions: (1) the measured value is below the reporting level and represented as left-censored data; or (2) there is a standard deviation and detection limit associated with the measured value, therefore, it is represented as interval-censored data. The upper and lower bounds of interval-censored data are calculated by adding and subtracting three standard deviations from the measured value, respectively. Interval-censored data with a lower or upper bound less than the detection limit is represented as left-censored data. For left-censored data, the upper bound is set to the detection limit when its magnitude is less than the detection limit.

Value

Returns an object of class list with data.frame components corresponding to unique parameter identifiers. Each data table has the following components:

Site_id

unique site identifier

Site_name

local site name

Date

observation date

code

single-digit character code

value

measured value

sd

standard deviation of the measured value.

dl

detection limit of the measured value.

surv

observation as censored or uncensored data of interval type.

Additional attributes associated with the returned data frame include: Parameter_id, unique parameter identifier; Parameter_name, parameter name; and Units, parameter units.

Author(s)

J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center

See Also

RunAnalysis


jfisher-usgs/Trends documentation built on May 19, 2019, 7:16 a.m.