xlog = TRUE 的错位网格线 - Forestplot - R

Misplaced grid lines with xlog=TRUE - Forestplot - R

拜托,我需要一些关于使用 xlog=TRUE 选项的帮助。

要求提供均值、下限、上限、零、网格和剪辑已经作为指数,但我发现包正在绘制我已经作为指数提供的数字的指数处的网格线。因此,网格线位于错误的位置。

metaan <- 
  structure(list(
    mean  = c(NA, NA, NA, 0.27, 0.47, 0.33, 0.69, 0.86, 0.37, 0.08, 0.44, 0.54, 0.41, NA), 
    lower = c(NA, NA, NA, 0.13, 0.12, 0.19, 0.12, 0.54, 0.17, 0.03, 0.16, 0.06, 0.29, NA),
    upper = c(NA, NA, NA, 0.58, 1.81, 0.60, 3.97, 1.36, 0.81, 0.21, 1.25, 4.50, 0.58, NA)),
    .Names = c("mean", "lower", "upper"), 
    row.names = c(NA, -27L), 
    class = "data.frame")

tabletext<-cbind(
  c("", "AB class", "", "     Aminoglycosides", "     B-lactams", "     Cephalosporins", "     Fenicoles", "     Fluoroquinolones", "     Multiresistance", "     Sulphamides", "     Tetracyclines", "     Tri/Sulpha", "     Subtotal", ""),  
  c("", "OR", "", "0.27", "0.47", "0.33", "0.69", "0.86", "0.37", "0.08", "0.44", "0.54", "0.41", ""),
  c("", "n", "", "4", "3", "2", "3", "4", "2", "3", "4", "3", "5", ""))

xticks <- c(0.1, 0.25, 0.5, 1, 1.5, 2, 3)

forestplot(tabletext,
           graph.pos = 3,
           txt_gp = fpTxtGp(label = gpar(fontsize=10)),
           hrzl_lines = list("3" = gpar(lty=1)),
           zero = 1,
           line.margin = .05,
           mean = cbind(metaan[,"mean"]),
           lower = cbind(metaan[,"lower"]),
           upper = cbind(metaan[,"upper"]),
           is.summary=c(FALSE, TRUE, rep(FALSE, 9)),
           col=fpColors(box=c("blue"), summary=c("blue")),
           grid = structure(0.41, 
                            gp = gpar(lty = 2, col = "#CCCCFF")),
           clip=c(0.1, 3),
           xlog=T,
           xticks=xticks,
           xlab="Odds ratio")

The grid line is at the exponential of OR=0.41, instead of at OR=0.41

当提供日志以在正确的位置获取网格线时(例如 -0.38 或 log(0.41)),我收到错误消息,提示我应该提供所有已作为指数的参数。

forestplot(tabletext,
           graph.pos = 3,
           txt_gp = fpTxtGp(label = gpar(fontsize=10)),
           hrzl_lines = list("3" = gpar(lty=1)),
           zero = 1,
           line.margin = .05,
           mean = cbind(metaan[,"mean"]),
           lower = cbind(metaan[,"lower"]),
           upper = cbind(metaan[,"upper"]),
           is.summary=c(FALSE, TRUE, rep(FALSE, 9)),
           col=fpColors(box=c("blue"), summary=c("blue")),
           grid = structure(-0.39, 
                            gp = gpar(lty = 2, col = "#CCCCFF")),
           clip=c(0.1, 3),
           xlog=T,
           xticks=xticks,
           xlab="Odds ratio")

Error in forestplot.default(tabletext, graph.pos = 3, txt_gp = fpTxtGp(label = gpar(fontsize = 10)),  : 
  All argument values (mean, lower, upper, zero, grid and clip) should be provided as exponentials when using the log scale. This is an intentional break with the original forestplot function in order to simplify other arguments such as ticks, clips, and more.

我曾尝试将网格编号包含在列表中,但如果我以指数(网格错位)或对数(错误消息)形式提供数字,我总是会遇到相同的错误消息。

我想知道我做错了什么,是否有任何其他方法可以将网格线放在正确的位置。

提前致谢,

玛格达。

已解决。从 GitHub 更新到 1.8 包版本并得到正确的数字。 :)