| autoplot.unsurv_compare | R Documentation |
Plots Kaplan-Meier survival curves for each cluster, faceted by
comparison method, for an object returned by unsurv_compare.
## S3 method for class 'unsurv_compare'
autoplot(object, ...)
## S3 method for class 'unsurv_compare'
plot(x, ...)
object |
An object of class |
... |
Unused. |
x |
An object of class |
A ggplot object.
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.