autoplot.unsurv_compare: Kaplan-Meier plot for a partition comparison

View source: R/compare.R

autoplot.unsurv_compareR Documentation

Kaplan-Meier plot for a partition comparison

Description

Plots Kaplan-Meier survival curves for each cluster, faceted by comparison method, for an object returned by unsurv_compare.

Usage

## S3 method for class 'unsurv_compare'
autoplot(object, ...)

## S3 method for class 'unsurv_compare'
plot(x, ...)

Arguments

object

An object of class "unsurv_compare".

...

Unused.

x

An object of class "unsurv_compare".

Value

A ggplot object.

Examples

if (requireNamespace("survival", quietly = TRUE) &&
    requireNamespace("ggplot2", quietly = TRUE)) {
  set.seed(1)
  n <- 120
  time <- stats::rexp(n, 0.1)
  status <- sample(0:1, n, TRUE)
  labs <- list(
    unsurv_curve = sample(1:3, n, TRUE),
    scalar_risk = sample(1:3, n, TRUE)
  )
  cmp <- unsurv_compare(labs, time, status)
  ggplot2::autoplot(cmp)
}

unsurv documentation built on Sept. 1, 2026, 1:06 a.m.