使用风险比和置信区间的森林图
Forest plot using risk ratio and confidence intervals
如何使用带有比较标签的风险比和置信区间来制作这样的森林图?
我不希望 R 自动对比较进行分组,我只想绘制带有左侧标签的森林图。谢谢。
我使用这个代码:
d=result
df=data.frame(d)
cochrane_from_rmeta <-
structure(list(
mean = df$RiskRatio,
lower = df$LowerLimit,
upper = df$UpperLimit),
.Names = c("RiskRatio", "lower", "upper"),
row.names = c(NA, -14L),
class = "data.frame")
tabletext<-cbind(
c(df$Outcomes),
c(df$Comparison),
c(df$...4),
c(df$RiskRatio))
forestplot(tabletext,
cochrane_from_rmeta,new_page = TRUE,
is.summary=c(TRUE,TRUE,rep(FALSE,8),TRUE),
clip=c(0.1,2.5),
xlog=TRUE,
col=fpColors(box="royalblue",line="darkblue", summary="royalblue"))
但是显示错误
这是您要实现的目标吗?
#install.packages("forestplot")
library(forestplot)
# Cochrane data from the 'rmeta'-package
cochrane_from_rmeta <-
structure(list(
mean = c(NA, NA, 0.578, 0.165, 0.246, 0.700, 0.348, 0.139, 1.017, NA, 0.531),
lower = c(NA, NA, 0.372, 0.018, 0.072, 0.333, 0.083, 0.016, 0.365, NA, 0.386),
upper = c(NA, NA, 0.898, 1.517, 0.833, 1.474, 1.455, 1.209, 2.831, NA, 0.731)),
.Names = c("mean", "lower", "upper"),
row.names = c(NA, -11L),
class = "data.frame")
tabletext<-cbind(
c("", "Study", "Auckland", "Block",
"Doran", "Gamsu", "Morrison", "Papageorgiou",
"Tauesch", NA, "Summary"),
c("",
"Comparison",
"Placebo 1",
"Placebo 2",
"Placebo 3",
"Placebo 4",
"Placebo 5",
"Treatment 1",
"Treatment 2",
NA,
""),
c("",
"Relative Risk \n 95% CI",
"0.88 (0.84-0.92)",
"0.87 (0.81-0.94)",
"0.88 (0.84-0.92)",
"0.87 (0.81-0.94)",
"0.88 (0.84-0.92)",
"0.88 (0.84-0.92)",
"0.87 (0.81-0.94)",
NA,
"0.87 (0.81-0.94)"),
c("", "OR", "0.58", "0.16",
"0.25", "0.70", "0.35", "0.14",
"1.02", NA, "0.53"),
c("", "F", "1.1", "1.3",
"0.2", "5", "3.1", "0",
"0.1", NA, "4.1"))
forestplot(tabletext,
cochrane_from_rmeta,
graph.pos = 3,
new_page = TRUE,
is.summary=c(rep(FALSE,11)),
clip=c(0.1,2.5),
xlog=TRUE,
col=fpColors(box="royalblue",
line="darkblue",
summary="royalblue"))
如何使用带有比较标签的风险比和置信区间来制作这样的森林图? 我不希望 R 自动对比较进行分组,我只想绘制带有左侧标签的森林图。谢谢。
我使用这个代码:
d=result
df=data.frame(d)
cochrane_from_rmeta <-
structure(list(
mean = df$RiskRatio,
lower = df$LowerLimit,
upper = df$UpperLimit),
.Names = c("RiskRatio", "lower", "upper"),
row.names = c(NA, -14L),
class = "data.frame")
tabletext<-cbind(
c(df$Outcomes),
c(df$Comparison),
c(df$...4),
c(df$RiskRatio))
forestplot(tabletext,
cochrane_from_rmeta,new_page = TRUE,
is.summary=c(TRUE,TRUE,rep(FALSE,8),TRUE),
clip=c(0.1,2.5),
xlog=TRUE,
col=fpColors(box="royalblue",line="darkblue", summary="royalblue"))
但是显示错误
这是您要实现的目标吗?
#install.packages("forestplot")
library(forestplot)
# Cochrane data from the 'rmeta'-package
cochrane_from_rmeta <-
structure(list(
mean = c(NA, NA, 0.578, 0.165, 0.246, 0.700, 0.348, 0.139, 1.017, NA, 0.531),
lower = c(NA, NA, 0.372, 0.018, 0.072, 0.333, 0.083, 0.016, 0.365, NA, 0.386),
upper = c(NA, NA, 0.898, 1.517, 0.833, 1.474, 1.455, 1.209, 2.831, NA, 0.731)),
.Names = c("mean", "lower", "upper"),
row.names = c(NA, -11L),
class = "data.frame")
tabletext<-cbind(
c("", "Study", "Auckland", "Block",
"Doran", "Gamsu", "Morrison", "Papageorgiou",
"Tauesch", NA, "Summary"),
c("",
"Comparison",
"Placebo 1",
"Placebo 2",
"Placebo 3",
"Placebo 4",
"Placebo 5",
"Treatment 1",
"Treatment 2",
NA,
""),
c("",
"Relative Risk \n 95% CI",
"0.88 (0.84-0.92)",
"0.87 (0.81-0.94)",
"0.88 (0.84-0.92)",
"0.87 (0.81-0.94)",
"0.88 (0.84-0.92)",
"0.88 (0.84-0.92)",
"0.87 (0.81-0.94)",
NA,
"0.87 (0.81-0.94)"),
c("", "OR", "0.58", "0.16",
"0.25", "0.70", "0.35", "0.14",
"1.02", NA, "0.53"),
c("", "F", "1.1", "1.3",
"0.2", "5", "3.1", "0",
"0.1", NA, "4.1"))
forestplot(tabletext,
cochrane_from_rmeta,
graph.pos = 3,
new_page = TRUE,
is.summary=c(rep(FALSE,11)),
clip=c(0.1,2.5),
xlog=TRUE,
col=fpColors(box="royalblue",
line="darkblue",
summary="royalblue"))