View source: R/kmciFunctions.R
tidykmciLR | R Documentation |
kmciLRtidy
, kmciLRgroup
, or a kmciLR
object.
Takes a kmciLRtidy
, kmciLRgroup
, or a kmciLR
object (a list) and converts it into a drameframe, which can further be used in plotting. Every two time points represents a time interval.
tidykmciLR(x)
x |
a kmciLRtidy, kmciLRgroup, or kmciLR object |
creates a dataframe. See description.
This function returns a dataframe with the following columns:
time |
Time |
surv |
Value of survival curve at that time point |
lower |
Lower bound of the CI for the survival curve |
upper |
Upper bound of the CI for the survival curve |
group |
treatment or grouping variable (if applicable) |
There are two rows per time point representing the change in either the survival function or confidence bands.
library(bpcp) data(leuk2) practice <- bpcpfit(Surv(time, status)~treatment, data=leuk2) tidy <- tidykmciLR(practice) ggplot(tidy, aes(x = time, y = surv, ymin = lower, ymax = upper, col = group)) + geom_line(show.legend=FALSE) + geom_ribbon(alpha = .2, aes(fill=group)) + xlab("Time") + ylab("Survival") + ggtitle("K-M curves with bpcp CIs")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.