0

我正在尝试使用以下代码创建森林图,但它不起作用:

tabletext<-cbind(c("Study", "2.1", "27", "30.1", "40",NA,"Summary"), c("Events", "4", "5", "1", "14",NA,NA), c("Totals", "32", "10", "8", "28",NA,NA), c("LO", "-1.95", "0.00", "-1.95", "0.00",NA,"-0.85")) 

cochrane_from_meta<-structure(list(mean=c(NA,-1.95, 0.00, -1.95, 0.00,NA,-0.85), lower=c(NA,-2.99, -1.24, -4.04, -0.74,NA,-1.96), upper=c(NA,-0.90, 1.24, 0.15, 0.74,NA,0.27)), .Names=c("mean", "lower", "upper"), row.names=c(NA, -11L),class="data.frame")

 forestplot(tabletext, cochrane_from_meta, new_page=TRUE, clip=c(0.1, 2.5), xlog=TRUE, is.summary=c(TRUE, TRUE, rep(FALSE,5), TRUE), col=fpColors(box="royalblue", line="darkblue", summary="royalblue"))

我不断收到相同的错误消息:

Error in prFpConvertMultidimArray(mean) : 
  Sorry did not manage to automatically identify the upper/lower boundaries.

任何帮助将非常感激!

编辑:

我希望我的情节如下所示:

在此处输入图像描述

从第一个答案中的代码生成的图表在这里:

在此处输入图像描述

4

1 回答 1

1

以下语法在这里有效:

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")

不知何故功能:

 prFpConvertMultidimArray(mean)

对它转换的对象类型非常挑剔。

于 2016-03-24T11:35:40.287 回答