Converts Surv object into a 3-column matrix

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"

Value

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

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".

Examples

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