KM曲线

#######################KM曲线
rm(list = ls())   #清理环境
library(survival)
library(survminer)
df = read.csv("../rawdata/xxx.csv",row.names = 1)
# 1.0 sex categorica
fit_stage = survfit(Surv(time = survival_time,event = survival_state)~T_stage,
                  data=df)
# about the argument of ggsurvplot , please see http://www.sci666.net/55393.html
ggsurvplot(fit_stage,
           pval = T, # P-value
           conf.int = F, # confidence interval
           risk.table = T, # the table below the plot
           palette = "npg", # change the color
           legend = c(0.8,0.8), # the possion of legend
           legend.title = "T_stage", # the title of legend
           legend.labs = c("1","2","3","4"), # the label of legend 数量需与T_stage一致
           xlab = "Follow up time (months)" # the label of x-axis
)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
禁止转载,如需转载请通过简信或评论联系作者。

推荐阅读更多精彩内容