Is there a way to change the colour of complete rows in a forest plot based on text?
For example, in the plot below, I'd like to be able to have four different row colours, one for each of DEF, RU, MID & FWD in the Player column.
The col
argument can take a vector of colors. So, something like this should work:
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)