Learn R Programming

bpcp (version 1.4.2)

tidykmciLR: Dataframe of kmciLRtidy, kmciLRgroup, or a kmciLR object.

Description

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.

Usage

tidykmciLR(x)

Arguments

x

a kmciLRtidy, kmciLRgroup, or kmciLR object

Value

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.

Details

creates a dataframe. See description.

Examples

Run this code
# NOT RUN {
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") 
# }

Run the code above in your browser using DataLab