I draw Kaplan-Meier survival curve using survfit
and ggsurvplot
(60 months survival) :
surv <- survfit(Surv(time, status) ~ group, data = dataK)
ggsurvplot(surv,size = 1, censor.size = 6,risk.table = TRUE,pval = TRUE, conf.int = F,pval.coord = c(45,1), xlim = c(0,60),xlab = "Time in months",ylab = "survival",break.time.by = 12, risk.table.y.text.col = T,risk.table.y.text = T, legend.title = "",legend.labs = c("hi", "low")
Because I don't have enough subjects for 60 months analysis, I want to restrict my log rank analysis to a 24 months survival analysis (see dotted line).
I can't find a way to do this. I restricted ggplot2 timeline by changing xlim = c(0,60)
to xlim = c(0,24)
but it only change the graph aspect and does not censor upcoming data (the p-value does not change).