0

我尝试使用 rmeta 包生成没有汇总估计的“森林图”。但是,使用 ?forestplot 然后从描述或示例开始并没有帮助,我总是遇到同样的错误。我认为这是一个简单的问题,与矩阵/向量长度有点不对齐,但我一直在更改和调整,但仍然找不到错误...

这是示例代码:

tabletext<-cbind(c(NA, NA, NA, NA, NA, NA),
             c(NA, NA, NA, NA, NA, NA),
             c("variable1","subgroup","2nd", "3rd", "4th", "5th"),
             c(NA,"mean","1.8683639", "2.5717301", "4.4966049, 9.0008054")
             )
tabletext
png("forestplot.png")
forestplot(tabletext, mean = c(NA, NA, 1.8683639, 2.5717301, 4.4966049, 9.0008054), lower = c(NA, NA, 1.4604643, 2.0163468, 3.5197956, 6.9469213), upper = c(NA, NA, 2.3955105, 3.2897459, 5.7672966, 11.7288609), 
is.summary = c(rep(FALSE, 6)), zero = 1, xlog=FALSE, boxsize=0.75, xticks = NULL, clip = c(0.9, 12))
dev.off()

错误信息:

 clip = c(0.9, 12))
Error in unit(rep(1, sum(widthcolumn)), "grobwidth", labels[[1]][widthcolumn]) : 
  'x' and 'units' must have length > 0
 dev.off()

很感谢任何形式的帮助!

4

1 回答 1

0

这适用于 forestplot-package 虽然您需要删除xticks=NULL

tabletext<-cbind(c(NA, NA, NA, NA, NA, NA),
                 c(NA, NA, NA, NA, NA, NA),
                 c("variable1","subgroup","2nd", "3rd", "4th", "5th"),
                 c(NA,"mean","1.8683639", "2.5717301", "4.4966049, 9.0008054")
)

png("forestplot.png")
forestplot(tabletext, 
           mean = c(NA, NA, 1.8683639, 2.5717301, 4.4966049, 9.0008054), 
           lower = c(NA, NA, 1.4604643, 2.0163468, 3.5197956, 6.9469213), 
           upper = c(NA, NA, 2.3955105, 3.2897459, 5.7672966, 11.7288609), 
           is.summary = c(rep(FALSE, 6)), zero = 1, 
           xlog=FALSE, boxsize=0.75,  clip = c(0.9, 12))
dev.off()

Gives(我建议在提交发布之前进行一些润色):

在此处输入图像描述

于 2015-08-30T18:53:46.577 回答