as.data.frame.survfit.Rd
This function returns a data frame containing following variables derived from a survfit object. Extends the S3 survfit class.
t - Time
s - KM Survival estimate
c - Censoring indicator - 0 is censored, 1 is event
strata - character description of strata that survival estimates are for
Plus all strata variables
# S3 method for survfit
as.data.frame(x)
survfit object (survival)
library(survival)
#>
#> Attaching package: ‘survival’
#> The following object is masked from ‘package:rpsftm’:
#>
#> cox.zph
sf <- survfit(Surv(time, status)~x, data = survival::aml)
as.data.frame(sf)
#> t s c strata x
#> 1 0 1.00000000 0 x=Maintained Maintained
#> 2 9 0.90909091 0 x=Maintained Maintained
#> 3 13 0.81818182 1 x=Maintained Maintained
#> 4 18 0.71590909 0 x=Maintained Maintained
#> 5 23 0.61363636 0 x=Maintained Maintained
#> 6 28 0.61363636 1 x=Maintained Maintained
#> 7 31 0.49090909 0 x=Maintained Maintained
#> 8 34 0.36818182 0 x=Maintained Maintained
#> 9 45 0.36818182 1 x=Maintained Maintained
#> 10 48 0.18409091 0 x=Maintained Maintained
#> 11 161 0.18409091 1 x=Maintained Maintained
#> 12 0 1.00000000 0 x=Nonmaintained Nonmaintained
#> 13 5 0.83333333 0 x=Nonmaintained Nonmaintained
#> 14 8 0.66666667 0 x=Nonmaintained Nonmaintained
#> 15 12 0.58333333 0 x=Nonmaintained Nonmaintained
#> 16 16 0.58333333 1 x=Nonmaintained Nonmaintained
#> 17 23 0.48611111 0 x=Nonmaintained Nonmaintained
#> 18 27 0.38888889 0 x=Nonmaintained Nonmaintained
#> 19 30 0.29166667 0 x=Nonmaintained Nonmaintained
#> 20 33 0.19444444 0 x=Nonmaintained Nonmaintained
#> 21 43 0.09722222 0 x=Nonmaintained Nonmaintained
#> 22 45 0.00000000 0 x=Nonmaintained Nonmaintained