unSurv: Converts Surv object into a 3-column matrix

View source: R/unSurv.R

unSurvR Documentation

Converts Surv object into a 3-column matrix

Description

Converts Surv object into a 3-column matrix

Usage

unSurv(x, col_lo = "lo", col_hi = "hi")

Arguments

x

vector (Surv object)

col_lo

Output column name for "lo" values. Default = "lo"

col_hi

Output column name for "hi" values. Default = "hi"

Details

The third column of the returned matrix (type) has the following meanings:

1 – no censoring

2 – left censored ("less than in a survival sense" , e.g., [-Inf to 10], <10)

3 – interval censored ("less than in a water quality sense", e.g., "0 - <3", "1 - 3")

NA – missing value

The user can specify the names of the low and high columns in the output. Defaults are "lo" and "hi".

Value

Returns a 3-column matrix: lo, hi, type

See Also

makeSurvDF, unSurvDF , impute, imputeDF, saveDF,

Examples

df1 <- dataCensored[dataCensored$station=="CB3.3C"
          & dataCensored$date < as.POSIXct("1985-08-01") 
          , c("station","date","chla")]
colnames(df1)
# Default values
chla_1 <- unSurv(df1$chla)
colnames(chla_1)
# User values
chla_2 <- unSurv(df1$chla, "LOW", "HIGH")
colnames(chla_2)


leppott/baytrends documentation built on Nov. 2, 2024, 6:42 p.m.