ggsurv: Survfit for ggplot2

Description Usage Arguments Value Author(s) Examples

View source: R/ggsurv.R

Description

ggsurv creates a data.frame of a coxph or a survfit object for visualization with ggplot2

Usage

1
ggsurv(x, lims = NULL)

Arguments

x

a coxph or survfit object

lims

not implemented

Value

data.frame with time, strata, std_err, upper, lower, n_risk, n_event, n_centor, and surv. Optionaly if object is coxph, it returns cumhaz and if the object is stratified, strata.

Author(s)

Johan Junkka

Examples

1
2
3
4
library(survival)
library(ggplot2)
surv_object <- coxph(Surv(time, status) ~ strata(x), data = aml)
ggplot(ggsurv(surv_object), aes(time, surv, color=strata)) + geom_step()

junkka/ehahelper documentation built on March 17, 2021, 2:12 a.m.