surv_extract | R Documentation |
survfit
summariesConvenience functions to print results from summary(x)$table
where x
is a survfit
object.
surv_median
and surv_prob
extract median(s) and survival
estimate(s) with optional confidence intervals, respectively.
surv_extract
is a generic extractor.
surv_extract(object, what = "median")
surv_median(
object,
ci = FALSE,
digits = 0L,
which = NULL,
print = TRUE,
na = ifelse(ci, "NR", "not reached"),
show_conf = TRUE,
type = c("conf.int", "range")
)
surv_prob(
object,
times = pretty(object$time),
ci = FALSE,
digits = ifelse(percent, 0L, 2L),
which = 1L,
print = TRUE,
show_conf = TRUE,
percent = FALSE
)
object |
an object of class |
what |
the data to return, either the index, character string(s), or
|
ci |
logical; if |
digits |
number of digits past the decimal point to keep |
which |
optional integer or character vector to select or re-order
the output; |
print |
logical; if |
na |
a character string to replace |
show_conf |
logical; if |
type |
if |
times |
vector of times passed to |
percent |
logical; if |
library('survival')
sfit1 <- survfit(Surv(time, status) ~ 1, lung)
sfit2 <- survfit(Surv(time, status) ~ sex, lung, conf.int = 0.9)
surv_extract(sfit1, NULL)
surv_extract(sfit1, 2:3)
surv_extract(sfit2, 'median|CL')
surv_extract(sfit2, c('events', 'median'))
surv_median(sfit1)
surv_median(sfit2)
surv_median(sfit2, print = FALSE)
surv_median(sfit1, ci = TRUE)
surv_median(sfit2, ci = TRUE)
surv_median(sfit2, ci = TRUE, print = FALSE)
surv_median(sfit1, ci = TRUE, type = 'range')
surv_median(sfit2, ci = TRUE, type = 'range')
surv_median(sfit2, ci = TRUE, print = FALSE, type = 'range')
times <- 365.242 * c(0.5, 1, 2)
surv_prob(sfit1, times)
## compare
summary(sfit1, times)
surv_prob(sfit2, times, which = 'sex=2', digits = 3)
## compare
summary(sfit2, times)
surv_prob(sfit2, times = 365, ci = TRUE, which = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.