R语言可视化:森林图绘制

森林图绘制


清除当前环境中的变量

rm(list=ls())

设置工作目录

setwd("C:/Users/Dell/Desktop/R_Plots/39forest/")

使用survminer包中的ggforest函数绘制森林图

require("survival")
## Loading required package: survival
library(survminer)
## Warning: package 'survminer' was built under R version 3.6.3
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.6.3
## Loading required package: ggpubr
## Loading required package: magrittr

# 查看内置示例数据
head(colon)
##   id study      rx sex age obstruct perfor adhere nodes status differ
## 1  1     1 Lev+5FU   1  43        0      0      0     5      1      2
## 2  1     1 Lev+5FU   1  43        0      0      0     5      1      2
## 3  2     1 Lev+5FU   1  63        0      0      0     1      0      2
## 4  2     1 Lev+5FU   1  63        0      0      0     1      0      2
## 5  3     1     

你可能感兴趣的:(R语言大学作业,r语言,回归,开发语言)