surv_quantile | R Documentation |
Compute quantiles from survival curves.
surv_quantile(x, probs = 0.5, t, surv_cols, by)
x |
A |
probs |
A numeric vector of probabilities with values in |
t |
A character scalar of the name of the time column. |
surv_cols |
A character vector of the names of columns containing survival curves. |
by |
A character vector of the names of columns to group by. |
A data.table
of quantiles of each survival curve in
surv_cols
by each group in by
.
library("data.table") t <- seq(0, 10, by = .01) surv1 <- seq(1, .3, length.out = length(t)) surv2 <- seq(1, .2, length.out = length(t)) strategies <- c("Strategy 1", "Strategy 2") surv <- data.table(strategy = rep(strategies, each = length(t)), t = rep(t, 2), surv = c(surv1, surv2)) surv_quantile(surv, probs = c(.4, .5), t = "t", surv_cols = "surv", by = "strategy")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.