Skip to contents

Generates a number-at-risk table at fixed time points from a [run_kaplan_meier()] result. Useful for pre-computing Shiny display data and static API endpoints.

Usage

extract_risk_table(km_result, times = c(0, 365, 730, 1095, 1460))

Arguments

km_result

List returned by [run_kaplan_meier()]

times

Numeric vector of time points (in days) at which to evaluate the risk table. Defaults to `c(0, 365, 730, 1095, 1460)` (0-4 years).

Value

Data frame with columns: time, n_risk, n_event, n_censor, survival, and optionally strata (if stratified KM)