我正在尝试根据期刊指南调整我的森林图。其中之一就是改变所有“。”到“-”,例如“0.43”至“0-45”。很奇怪,我知道。是否有可能对森林图的摘要列执行此操作(在本例中为最右侧,请参阅示例代码)。 我觉得应该很容易,但我还没弄清楚。
这是示例代码:
library(metafor)
### copy BCG vaccine meta-analysis data into 'dat'
dat <- dat.bcg
### calculate log risk ratios and corresponding sampling variances (and use
### the 'slab' argument to store study labels as part of the data frame)
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat,
slab=paste(author, year, sep=", "))
### fit random-effects model
res <- rma(yi, vi, data=dat)
### forest plot with extra annotations
forest(res, atransf=exp, at=log(c(0.05, 0.25, 1, 4)), xlim=c(-16,6),
ilab=cbind(tpos, tneg, cpos, cneg), ilab.lab=c("TB+","TB-","TB+","TB-"),
ilab.xpos=c(-9.5,-8,-6,-4.5), cex=0.75, header="Author(s) and Year",
mlab="", shade=TRUE)
text(c(-8.75,-5.25), res$k+3, c("Vaccinated", "Control"), cex=0.75, font=2)
小数符号可以通过
options()
控制(在 R 内全局)——参见 help(options)
,特别是 OutDec
。因此,只需在创建绘图之前使用 options(OutDec="-")
即可。我不会评论这样一个事实:使用破折号作为小数符号是很奇怪(并且令人困惑)的。