[R-meta] Setting new default layout for forest plots

Magali Leyvraz m@g@||@|eyvr@z @end|ng |rom gm@||@com
Wed Oct 14 10:30:04 CEST 2020


Dear Prof Schwarzer,

I am using your package meta (which is really great by the way!) and I have to compile a lot of forest plots with all the same layouts. I would like to avoid having to repeat the graphical arguments for each new forest plot, kind of like for settings.meta where you can specify the default settings and don’t need to reset again every time. I’ve tried several ways but with no success so far. I was thinking one solution would be to create a new layout (additional to ‘meta’, ‘JAMA’, ‘RevMan5’, ‘subgroup’).Would you be able to help me?

Here’s an example of the graphical arguments I would like:
forest (x, digits=2, comb.random=T, prediction=F, just="center", type.study="square", type.random="diamond", col.study="black", col.square="red", col.square.lines="red", col.inside="black", col.diamond="black", col.diamond.lines="black", col.predict="black", col.predict.lines="black", col.by="black", col.label.right="black", col.label.left="black", lty.random=0, addrow=T, addrow.subgroups=T, addrow.subgroups.overall=T, addrow.overall=T, text.random="Total", hestat=TRUE, calcwidth.hetstat = TRUE, test.subgroup=T, subgroup=T, test.effect.subgroup.random=T, test.overall.random=T, resid.hetstat=F, colgap="0.3cm", digits.tau2=1, calcwidth.random=T, leftcols=c("studlab", "n.e", "n.c", "effect", "ci", "w.random"), rightscols=NULL, allstudies=F, print.byvar=F)

I tried: 
mylayout<-'digits=2, comb.random=T, prediction=F, just="center", type.study="square", type.random="diamond", col.study="black", col.square="red", col.square.lines="red", col.inside="black", col.diamond="black", col.diamond.lines="black", col.predict="black", col.predict.lines="black", col.by="black", col.label.right="black", col.label.left="black", lty.random=0, addrow=T, addrow.subgroups=T, addrow.subgroups.overall=T, addrow.overall=T, text.random="Total", hestat=TRUE, calcwidth.hetstat = TRUE, test.subgroup=T, subgroup=T, test.effect.subgroup.random=T, test.overall.random=T, resid.hetstat=F, colgap="0.3cm", digits.tau2=1, calcwidth.random=T, leftcols=c("studlab", "n.e", "n.c", "effect", "ci", "w.random"), rightscols=NULL, allstudies=F, print.byvar=F’
forest(x, mylayout)

But get the error message:
Error in forest.meta(x, mylayout) : 
  Number of studies in object 'x' and argument 'sortvar' have different length.

I also tried:
mylayout<-'digits=2, comb.random=T, prediction=F, just="center", type.study="square", type.random="diamond", col.study="black", col.square="red", col.square.lines="red", col.inside="black", col.diamond="black", col.diamond.lines="black", col.predict="black", col.predict.lines="black", col.by="black", col.label.right="black", col.label.left="black", lty.random=0, addrow=T, addrow.subgroups=T, addrow.subgroups.overall=T, addrow.overall=T, text.random="Total", hestat=TRUE, calcwidth.hetstat = TRUE, test.subgroup=T, subgroup=T, test.effect.subgroup.random=T, test.overall.random=T, resid.hetstat=F, colgap="0.3cm", digits.tau2=1, calcwidth.random=T, leftcols=c("studlab", "n.e", "n.c", "effect", "ci", "w.random"), rightscols=NULL, allstudies=F, print.byvar=F’
forest(x, layout=“mylayout”)

But get the error message:
Error: Argument 'layout' must be "meta", "RevMan5", "JAMA", or "subgroup”.

Many thanks in advance for your help, best regards,

Magali



More information about the R-sig-meta-analysis mailing list