我正在尝试使用以下代码创建森林图,但它不起作用:
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.
任何帮助将非常感激!
编辑:
我希望我的情节如下所示:
从第一个答案中的代码生成的图表在这里: