| plot.unsurv | R Documentation |
Produces a base R plot of the cluster medoid survival curves stored in the fitted object.
## S3 method for class 'unsurv'
plot(x, ...)
x |
An object of class |
... |
Additional arguments passed to |
Invisibly returns x.
if (requireNamespace("cluster", quietly = TRUE)) {
set.seed(1)
times <- seq(0, 4, length.out = 30)
grp <- rep(1:2, each = 8)
rates <- c(0.2, 0.55)
S <- sapply(times, function(t) exp(-rates[grp] * t))
fit <- unsurv(S, times, K = 2)
plot(fit)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.