as.data.frame.survfitr: Coerce a survfitr object to a data frame

View source: R/misc-methods.R

as.data.frame.survfitrR Documentation

Coerce a survfitr object to a data frame

Description

Returns the estimated curves in long ("tidy") format, one row per distinct event time (and group), ready for further processing or plotting.

Usage

## S3 method for class 'survfitr'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

a survfitr object.

row.names, optional

see as.data.frame(); ignored.

...

ignored.

Value

A data frame with columns group (only when the fit has strata), time, n.event, n.risk, surv and std.error (NA for estimators without standard errors).

Examples

data(MMC)
fit <- survfitr(Survr(id, time, event) ~ group,
  data = MMC,
  type = "wang-chang"
)
head(as.data.frame(fit))

survrec documentation built on Sept. 22, 2026, 9:07 a.m.