surv_summary | R Documentation |
Compared to the default summary() function, surv_summary()
creates a data frame containing a nice summary from
survfit
results.
surv_summary(x, data = NULL)
x |
an object of class survfit. |
data |
a dataset used to fit survival curves. If not supplied then data will be extracted from 'fit' object. |
An object of class 'surv_summary', which is a data frame with the following columns:
time: the time points at which the curve has a step.
n.risk: the number of subjects at risk at t.
n.event: the number of events that occur at time t.
n.censor: number of censored events.
surv: estimate of survival.
std.err: standard error of survival.
upper: upper end of confidence interval.
lower: lower end of confidence interval.
strata: stratification of survival curves.
In a situation, where survival curves have been fitted with one or more
variables, surv_summary object contains extra columns representing the
variables. This makes it possible to facet the output of
ggsurvplot
by strata or by some combinations of factors.
surv_summary object has also an attribut named 'table' containing information about the survival curves, including medians of survival with confidence intervals, as well as, the total number of subjects and the number of event in each curve.
Alboukadel Kassambara, alboukadel.kassambara@gmail.com
# Fit survival curves
require("survival")
fit <- survfit(Surv(time, status) ~ rx + adhere, data = colon)
# Summarize
res.sum <- surv_summary(fit, data = colon)
head(res.sum)
# Information about the survival curves
attr(res.sum, "table")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.