Learn R Programming

qwraps2 (version 0.6.1)

qkmplot: Kaplan-Meier Plot

Description

A ggplot2 version of a Kaplan-Meier Plot

Usage

qkmplot(x, conf_int = FALSE, ...)

qkmplot_bulid_data_frame(x)

# S3 method for survfit qkmplot_bulid_data_frame(x)

qrmst(x, tau = Inf)

# S3 method for survfit qrmst(x, tau = Inf)

# S3 method for qkmplot_data qrmst(x, tau = Inf)

Value

a ggplot.

Arguments

x

object

conf_int

logical if TRUE show the CI

...

Other arguments passed to survival::plot.survfit

tau

upper bound on time for restricted mean survival time estimate

Details

Functions to build, explicitly or implicitly, data.frames and then creating a ggplot2 KM plot.

More details and examples for graphics within qwraps2 are in the vignette(“qwraps2-graphics”, package = “qwraps2”)

Examples

Run this code
require(survival)

leukemia.surv <- survival::survfit(survival::Surv(time, status) ~ x, data = survival::aml)

qkmplot(leukemia.surv, conf_int = TRUE)

qkmplot_bulid_data_frame(leukemia.surv)

qrmst(leukemia.surv) # NaN for rmst.se in Nonmaintained strata as last observation is an event
qrmst(leukemia.surv, 44)

# pbc examples
pbc_fit <-
  survival::survfit(
      formula = survival::Surv(time, status > 0) ~ trt
    , data = pbc
    , subset = !is.na(trt)
  )

qkmplot(pbc_fit)
qkmplot(pbc_fit, conf_int = TRUE)

qrmst(pbc_fit)
qrmst(pbc_fit)

Run the code above in your browser using DataLab