lifetable: Generate lifetables for multiclass variables

View source: R/lifetable.R

lifetableR Documentation

Generate lifetables for multiclass variables

Description

Specify vector of time endpoints and create a cohort life table for two or more strata

Usage

lifetable(
  obj,
  ntimes = 3,
  times = NULL,
  nround = 3,
  show.strata = TRUE,
  strata.name = "strata",
  summary = FALSE
)

Arguments

obj

An object of class survfit

ntimes

number of time intervals

times

A vector of endpoints of time intervals to show life table calculations. By default, these are ntimes evenly spaced out endpoints based on the full range of survival times.

nround

number of digits to round table values

show.strata

logical; if TRUE (default), the variable name is appended to the beginning of each stratum in the lifetable's strata column

strata.name

column name for the different strata

summary

logical; if TRUE, a case processing summary is shown with number of subjects, events, censored, and percent censored per stratum.

Details

Essentially a wrapper around KMsurv::lifetab() that allows the user to input a survfit object instead of vectors of raw values.

Value

A table with the following columns:

strata

name of specific group in variable

times

time interval

nsubs

See KMsurv::lifetab()

nlost

See KMsurv::lifetab()

nrisk

See KMsurv::lifetab()

nevent

See KMsurv::lifetab()

surv

See KMsurv::lifetab()

pdf

See KMsurv::lifetab()

hazard

See KMsurv::lifetab()

se.surv

See KMsurv::lifetab()

se.pdf

See KMsurv::lifetab()

se.hazard

See KMsurv::lifetab()

Author(s)

Derek Chiu

See Also

KMsurv::lifetab()

Examples

library(survival)
obj <- survfit(Surv(futime, fustat) ~ rx, data = ovarian)
lifetable(obj)
lifetable(obj, ntimes = 4, show.strata = FALSE)
lifetable(obj, ntimes = 4, times = c(200, 500, 800, 1000))

TalhoukLab/biostatUtil documentation built on April 14, 2025, 4:15 a.m.