答案 0 :(得分:2)
col
参数可以采用颜色矢量。所以,这样的事情应该有效:
library(metafor)
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
cols <- c("red", "green", "blue")[match(dat$alloc, c("random", "alternate", "systematic"))]
forest(dat$yi, dat$vi, col=cols)