2020-07-05##生存曲线+置信区间+风险表

install.packages("survminer")

library(survminer)

library(survival)

fit <- survfit(Surv(time, status) ~ sex, data = lung)

#简单的生存曲线 

p1 <- ggsurvplot(fit, data = lung,

                legend.title = 'Sex',

                legend = c(.85,.8))

##生存曲线+置信区间+风险表

p2 <- ggsurvplot(

  fit,

  data = lung,

  size = 1,               

  palette = c("#E7B800", "#2E9FDF"),

  conf.int = TRUE,         

  pval = TRUE,             

  risk.table = TRUE,       

  risk.table.col = "strata",

  legend.labs =

    c("Male", "Female"),   

  risk.table.height = 0.25,

  ggtheme = theme_bw(),

  legend.title = 'Sex',

  legend = c(.85,.8)

)

arrange_ggsurvplots(list(p1,p2),ncol = 2,nrow = 1)

你可能感兴趣的:(2020-07-05##生存曲线+置信区间+风险表)