as.mcens: Multiply-censored Data Conversion

as.mcensR Documentation

Multiply-censored Data Conversion

Description

Converts data to a multiply-censored data (mcens) object: various methods.

Usage

as.mcens(lower.val, upper.val, censor.codes)

## S4 method for signature 'mcens,missing,missing'
as.mcens(lower.val, upper.val, censor.codes)

## S4 method for signature 'lcens,missing,missing'
as.mcens(lower.val, upper.val, censor.codes)

## S4 method for signature 'numeric,missing,missing'
as.mcens(lower.val, upper.val, censor.codes)

## S4 method for signature 'numeric,numeric,missing'
as.mcens(lower.val, upper.val, censor.codes)

## S4 method for signature 'numeric,missing,numeric'
as.mcens(lower.val, upper.val, censor.codes)

## S4 method for signature 'numeric,missing,integer'
as.mcens(lower.val, upper.val, censor.codes)

## S4 method for signature 'numeric,missing,character'
as.mcens(lower.val, upper.val,
  censor.codes)

## S4 method for signature 'qw,missing,missing'
as.mcens(lower.val, upper.val, censor.codes)

## S4 method for signature 'character,missing,missing'
as.mcens(lower.val, upper.val,
  censor.codes)

Arguments

lower.val

The lower limit of the actual value, the special value of -Inf or NA can be used to indicate left-censoring. 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.

upper.val

The upper limit of the actual value, the special value of Inf or NA can be used to indicate right-censoring.

censor.codes

optional codes if upper.val is missing. Any numeric value less than 0 indicates left-censored, any value greater than 0 indicates right-censored, and 0 indicates an observed value. The character value "<" indicates left-censored, ">" indicates right-censored, any anything else indicates an observed value.

Details

In keeping with the logic of Surv, NA is permitted to indicate left- or right-censored data. If both are NA, then the observation is treated as missing.

Value

An S4 object of class "mcens." These objects are the basis for the analysis of censored data that are not strictly left censored.

References

Lorenz, D.L., in preparation

See Also

Surv

Examples

## Create one of each type of censoring, including uncensored
# the last value is missing
as.mcens(c(-Inf, 2, 2, 5, NA), c(1, 2, 3, Inf, NA))
# For combined remark and values:
as.mcens(c("<1", "1", ">3", "1", "2"))

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