Learn R Programming

maicplus (version 0.1.2)

medSurv_makeup: Helper function to retrieve median survival time from a survival::survfit object

Description

Extract and display median survival time with confidence interval

Usage

medSurv_makeup(km_fit, legend = "before matching", time_scale)

Value

a data frame with a index column 'type', median survival time and confidence interval

Arguments

km_fit

returned object from survival::survfit

legend

a character string, name used in 'type' column in returned data frame

time_scale

a character string, 'years', 'months', 'weeks' or 'days', time unit of median survival time

Examples

Run this code
data(adtte_sat)
data(pseudo_ipd_sat)
library(survival)
combined_data <- rbind(adtte_sat[, c("TIME", "EVENT", "ARM")], pseudo_ipd_sat)
kmobj <- survfit(Surv(TIME, EVENT) ~ ARM, combined_data, conf.type = "log-log")

# Derive median survival time
medSurv <- medSurv_makeup(kmobj, legend = "before matching", time_scale = "day")
medSurv

Run the code above in your browser using DataLab