Learn R Programming

ThomasJeffersonUniv (version 0.1.3)

Surv_3Date: Create Surv Object using Three Dates

Description

Create right-censored Surv object using start, stop and censoring dates.

Usage

Surv_3Date(start, stop, censor, units = "years", ...)

Value

Function Surv_3Date returns a Surv object.

Arguments

start, stop, censor

Date, POSIXlt or POSIXct object

units

(optional) character scalar, time units

...

potential parameters, currently not in use

Examples

Run this code
library(survival)
d1 = within(survival::udca, expr = {
  edp_yr = Surv_3Date(entry.dt, death.dt, last.dt, units = 'years')
  edp_mon = Surv_3Date(entry.dt, death.dt, last.dt, units = 'months') 
})
head(d1)

noout = within(survival::udca, expr = {
  edp_bug = Surv_3Date(entry.dt, death.dt, as.Date('1991-01-01'), units = 'months') 
})
subset(survival::udca, subset = entry.dt > as.Date('1991-01-01')) # check error as suggested

Run the code above in your browser using DataLab