I have two different data set, which basically contains the same data, but one is for baseline age 19 or younger (data.all.agefs.under19
) and the other one is for older than 19 (data.all.agefs.above19
)
The survival object of each is defined as:
surv.all.agefs.under19 <- Surv(time = data.all.agefs.under19$follow.up.years, event = data.all.agefs.under19$death.specific)
surv.all.agefs.above19 <- Surv(time = data.all.agefs.above19$follow.up.years, event = data.all.agefs.above19$death.specific)
The Cox PH model is defined as:
cox.all.agefs.under19 <- coxph(surv.all.agefs.under19 ~ factor1 + factor2 + factor3, data = data.all.agefs.under19)
cox.all.agefs.above19 <- coxph(surv.all.agefs.above19 ~ factor1 + factor2 + factor3, data = data.all.agefs.above19)
I would like to create a plot with Kaplan Meier curves for both, but so far, I can only create one for each one using ggsurvplot:
ggsurv <- ggsurvplot(survfit(cox.all.agefs.under19), data = data.all.agefs.under19, palette = "#2E9FDF", ggtheme = theme_minimal(), legend = "none")
ggsurv <- ggsurvplot(survfit(cox.all.agefs.above19), data = data.all.agefs.above19, palette = "#2E9FDF", ggtheme = theme_minimal(), legend = "none")
So how do I merge the two curves into the same plot?