xlog=TRUE - 森林图 - 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")

网格线位于 OR=0.41的指数处,而不是 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 包版本并获得正确的数字。:)

相关内容

  • 没有找到相关文章

最新更新