介绍
在做生存分析的时候需要画森林图,可以参考下列代码。
library(dplyr)
library(ggplot2)
library(survminer)
library(survival)
library(forestmodel)
pretty_lung <- lung %>%
transmute(time,
status,
Age = age,
Sex = factor(sex, labels = c("Male", "Female")),
ECOG = factor(lung$ph.ecog),
`Meal Cal` = meal.cal)
print(forest_model(coxph(Surv(time, status) ~ ., pretty_lung)))
image.png
网友评论