tte: Time-to-event data

tteR Documentation

Time-to-event data

Description

Calculate time-to-event and competing risks times and event indicators.

Usage

tte(start, fwup, ..., crisk = FALSE, fix = TRUE, censor = Inf, factor = 1)

Arguments

start, fwup

start and last follow-up date vectors

...

one or more event date vectors; note that event dates occurring before start are removed

crisk

logical; if TRUE, event dates are treated as competing events and the order of dates in ... matters, i.e., the first date takes precedence, and indicators are assigned in order of event date vectors

fix

logical; if TRUE (default); censor negative times at 0 and censor the event

censor

max time after which events/times are censored

factor

time factor to convert days (default) to months (e.g, use 30.437), years (365.242), etc.

Examples

dd <- data.frame(
  start = 0,
  end = 10,
  death = c(5, 2, NA, 2, NA),
  prog = c(3, 2, NA, 3, 5),
  trt = c(4, 1, NA, NA, 8)
)
dd[] <- lapply(dd, as.Date, origin = '2000-01-01')

tte(dd$start, dd$end, dd$death)
tte(dd$start, dd$end, dd$death, dd$prog)
tte(dd$start, dd$end, dd$death, dd$prog, crisk = TRUE)
tte(dd$start, dd$end, dd$death, dd$prog, dd$trt, crisk = TRUE)


raredd/rawr documentation built on Feb. 25, 2025, 1:48 p.m.