Learn R Programming

survminer (version 0.4.7)

surv_summary: Nice Summary of a Survival Curve

Description

Compared to the default summary() function, surv_summary() creates a data frame containing a nice summary from survfit results.

Usage

surv_summary(x, data = NULL)

Arguments

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.

Value

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.

Examples

Run this code
# NOT RUN {
# 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")


# }

Run the code above in your browser using DataLab