数据分析:生存分析的forest图
2024-05-14 本文已影响0人
生信学习者2
介绍
在做生存分析的时候需要画森林图,可以参考下列代码。
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)))
![](https://img.haomeiwen.com/i10780526/4f8b8c38eb01a305.png)