extract_survfit: Extract data from survfit object

Description Usage Arguments Value Author(s) Examples

View source: R/extract_survfit.R

Description

This function extracts the individual estimate information from a survfit object. This is mainly useful when plotting the survival function

Usage

1
extract_survfit(survfit_obj)

Arguments

survfit_obj

an object returned from the survival::survfit() function

Value

a data frame containing the estimate of the survival function

Author(s)

Patrick Hilden

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
df <-
  data.frame(
    fail_time = 12 * rexp(100),
    group = paste0('group_', sample(1:3, 100, replace = TRUE)),
    fail_status = sample(0:1, 100, replace = TRUE)
)

extract_survfit(
  survival::survfit(
    survival::Surv(fail_time, fail_status) ~ group,
    data = df
  )
)

hild0146/hildenp documentation built on May 17, 2019, 3:58 p.m.