surv_tables: Extract Tables from an R4VN Survival Result

View source: R/surv-export.R

surv_tablesR Documentation

Extract Tables from an R4VN Survival Result

Description

Converts every non-empty report component of a tabsurv() result to a named list of data frames, including descriptive, life-table, and optional interpretation tables. For a hierarchical result, tables are retained separately for every outer stratum. This keeps survival export compatible with the existing tabexport() data-frame workflow without changing tabexport() itself. Examples are self-contained.

Usage

surv_tables(x)

Arguments

x

An object returned by tabsurv().

Value

A named list of data frames.

Examples

if (requireNamespace("survival", quietly = TRUE)) {
  d <- data.frame(time = c(5, 8, 10, 12, 15, 18),
                  event = c(1, 0, 1, 1, 0, 1),
                  group = factor(rep(c("A", "B"), 3)))
  s <- tabsurv(time, event, by = group, data = d, show = FALSE)
  z <- surv_tables(s)
  names(z)
}

R4VN documentation built on Sept. 30, 2026, 5:13 p.m.