as.lcens: Left-censored Data Conversion

Description Usage Arguments Value Note References See Also Examples

Description

Converts data to a left-censored data (lcens) object: various methods.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
as.lcens(values, detlim, censor.codes)

## S4 method for signature 'lcens,missing,missing'
as.lcens(values, detlim, censor.codes)

## S4 method for signature 'numeric,missing,missing'
as.lcens(values, detlim, censor.codes)

## S4 method for signature 'numeric,numeric,missing'
as.lcens(values, detlim, censor.codes)

## S4 method for signature 'numeric,numeric,logical'
as.lcens(values, detlim, censor.codes)

## S4 method for signature 'numeric,numeric,character'
as.lcens(values, detlim, censor.codes)

## S4 method for signature 'numeric,missing,logical'
as.lcens(values, detlim, censor.codes)

## S4 method for signature 'numeric,missing,character'
as.lcens(values, detlim, censor.codes)

## S4 method for signature 'qw,missing,missing'
as.lcens(values, detlim, censor.codes)

## S4 method for signature 'qw,numeric,missing'
as.lcens(values, detlim, censor.codes)

## S4 method for signature 'character,missing,missing'
as.lcens(values, detlim, censor.codes)

Arguments

values

numeric values representing "raw" values. Missing values are permitted. A vector of character strings is allowed when the remark code is combined with the value; blank values are treated as missing values, any other value is converted to a missing value with a warning. See Examples.

detlim

the corresponding detection limit of the sensor. Missing values are permitted. Detection limits are required for each non-missing value in values; they will be imputed if missing. The imputation scheme is fairly sophisticated, see Lorenz (in preparation) for details, so it is better to set to missing, rather than provide an arbitrary detection limit.

censor.codes

optional codes indicating a left-censored value. If class "logical," then TRUE indicates left-censored. If class "character," then "<" indicates left-censored and anything other than "" or " " generates a warning.

Value

An S4 object of class "lcens." These objects are the basis for the analysis of left-censored data.

Note

All methods force values to be no less than the corresponding detlim. All values that are less than detlim are treated as left-censored values at detlim. This ensures unbiased analytical results.

References

Lorenz, D.L., in preparation

See Also

as.mcens

Examples

1
2
3
4
5
6
7
## The first value is censored at 2
as.lcens(c(1,3), 2)
## Set the first value to censored at that level and the detection limit is
# carried forward
as.lcens(c(1,3), censor.codes=c("<", ""))
# For combined remark and values:
as.lcens(c("<1", "1", "<1", "1", "2"))

leppott/baytrends033 documentation built on July 28, 2018, 10:30 p.m.