surv_cp: Create counting process data

surv_cpR Documentation

Create counting process data

Description

Converts a data frame to counting process notation and allows for time-dependent variables to be introduced.

Usage

surv_cp(
  data,
  time.var,
  status.var,
  covars = setdiff(names(data), c(time.var, status.var))
)

Arguments

data

data frame with survival time, survival status, and other covariates

time.var

data variable name representing survival time

status.var

data variable name representing status

covars

other covariates to retain

Value

A data frame with events in counting process notation.

References

http://www.ddiez.com/teac/surv/

Examples

library('survival')
cp <- surv_cp(aml, 'time', 'status')
coxph(Surv(start, stop, status) ~ x, data = cp)

## compare to
coxph(Surv(time, status) ~ x, data = aml)


raredd/rawr documentation built on March 4, 2024, 1:36 a.m.