calc_surv_p_table: Calculate time-to-event estimates

View source: R/calc_surv_p_table.R

calc_surv_p_tableR Documentation

Calculate time-to-event estimates

Description

Takes a survfit object and returns a tibble with proportion surviving at given times and confidence intervals.

Usage

calc_surv_p_table(
  fit,
  times = c(0, 12, 24, 36, 48),
  all_group_name = "All subjects"
)

Arguments

fit

survfit object

times

A numeric vector

all_group_name

String name for all records. Default is "All subjects".

Value

A tibble

Examples

library(survival)
library(dplyr)
head(aml)

fit <- survival::survfit(
  survival::Surv(time = time,
                 event = status) ~ x,
  data = aml)

calc_surv_p_table(fit)
calc_surv_p_table(fit, times = c(6, 18, 30))

fit <- survival::survfit(
  survival::Surv(time = time,
                 event = status) ~ 1,
  data = aml)

calc_surv_p_table(fit)
calc_surv_p_table(fit, times = c(6, 18, 30))


emilelatour/lamisc documentation built on April 9, 2024, 10:33 a.m.