code01: Code Censored Values

View source: R/code01.R

code01R Documentation

Code Censored Values

Description

Recodes censored data to a binary coding system with 0 indicating less than some critical value and 1 indicating greater than or equal to that critical value.

Usage

code01(..., criteria)

## Default S3 method:
code01(..., criteria)

## S3 method for class 'data.frame'
code01(..., criteria)

Arguments

...

either a data frame that contains columns of class "qw" or any combination of individual vectors of class "integer," "numeric," "lcens," or "qw." Missing values are removed before processing.

criteria

a vector indicating the critical values for each repsective value in .... May be a named vector containing critical values for the named argument in ... or not supplied. For any argument in ... that does not have a critical value, the critical value is the largest censoring level or if the data have no censored values, the median. The critical value can never be smaller than the largest censoring level and will be changed with a warning message. A special case is for integer values that have a minimum of 0—for those data the default criterion is to return 0 if the value is 0 and return 1 for any other value.

Value

A data frame containing the binary coded values. Each column has an attribute called "critical.value" that reports the critical value used to recode the values in that column. The column names are taken from ...; the rownames are derived from the sequential numbers of the original data.


USGS-R/smwrQW documentation built on Oct. 11, 2022, 6:13 a.m.