add_CI | R Documentation |
Method to add pointwise confidence intervals to a an object
created by visR through an S3 method. The method is set up to use
the pipe %>%
. There are two options to display CI's, a "ribbon" or
as "step" lines.
No default method is available at the moment.
add_CI(gg, ...)
## S3 method for class 'ggsurvfit'
add_CI(gg, alpha = 0.1, style = "ribbon", linetype, ...)
## S3 method for class 'ggtidycuminc'
add_CI(gg, alpha = 0.1, style = "ribbon", linetype, ...)
gg |
A ggplot created with visR |
... |
other arguments passed on to the method to modify |
alpha |
aesthetic of ggplot2 |
style |
aesthetic of ggplot2 |
linetype |
aesthetic of ggplot2 |
Pointwise confidence interval overlayed on a visR ggplot
library(visR)
# Estimate KM curves by treatment group
survfit_object <- survival::survfit(data = adtte, survival::Surv(AVAL, 1 - CNSR) ~ TRTP)
## plot without confidence intervals (CI)
p <- visR::visr(survfit_object)
p
# add CI to plot with default settings
p %>% add_CI()
# change transparency of CI ribbon
p %>% add_CI(alpha = 0.9, style = "ribbon")
# plot CI as a step line instead of ribbon
p %>% add_CI(alpha = 0.1, style = "step")
# change linetype of CI
p %>% add_CI(style = "step", linetype = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.