Teach you how to draw a forest map of interactive effects using R language

Interaction effect analysis is an important component in SCI, which can express the result relationship between independent variables and dependent variables in a special population (that is, a subgroup). It can be said to be a must-do project for high-scoring SCI. In SCI, this part Many of the results are displayed in forest plots, so the results are intuitive and easy to analyze. For example, this article in New Granville.
Insert picture description here
Another example is this.
Insert picture description here
We use R language today to demonstrate how to make such forest plots
. We need the forestplot package. Download it beforehand,
enter the data into the following format and import it into RStudio.
Insert picture description here
First import the R package and import the data into
library(forestplot)
f<- read.csv('e:/r/test/foresttest.csv',header = F )
this is the way we import data R of
Insert picture description here
drawing forest plot
Insert picture description here

       is.summary = c(T,T,F,F,T,F,F,T,F,F,T,F,F,T,F,F,F,T,F,F,F,T,F,F,F,T,F,F,F,T,F,F,F,T,F,F,T,F,F),
       #对信息进行汇总
       graph.pos = 4,graphwidth = unit(60,"mm"),#设置图片位置和宽度
       boxsize =0.2,line.margin = unit(5,"mm"),#对散点和线条进行设置
       lineheight = unit(5,"mm"),#设置图形行距
       col=fpColors(box = "grey0",lines = "grey0",summary = "grey0"),
       colgap = unit(1,"mm"),#图形列间距
       zero = 1,#参照值
       xticks = c(0,1,2))#X轴的定义标签

In this way, the forest map is drawn, and we can also modify the details of the picture. Everyone slowly explore
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/dege857/article/details/109198211