I am using metafor to create forest plots. This code gives me the expected plot (setting x axis tick marks): forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, at=log(c(.05, .25, 1, 10)), slab=forest$SNP, atransf=exp) As does this (setting colors): forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, col=c(1,2,3), slab=forest$SNP, atransf=exp) But if I try to set both 'at' and 'col': forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, col=c(1,2,3), at=log(c(.05, .25, 1, 10)), slab=forest$SNP, atransf=exp) I receive this error: Error in polygon(x = c(alim[2], alim[2] - (1.4/100) * cex * (xlim[2] - : formal argument "col" matched by multiple actual arguments Any help greatly appreciated. Brian Z Ring PhD Professor, Director Institute of Personalized and Genomic Medicine College of Life Science Huazhong University of Science and Technology Wuhan, ?China
package metafor: error when setting 'col' and 'at' for a forest plot
3 messages · Brian Z Ring, David Winsemius
On Jan 4, 2013, at 9:13 PM, Brian Z Ring wrote:
I am using metafor to create forest plots. This code gives me the expected plot (setting x axis tick marks): forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, at=log(c(. 05, .25, 1, 10)), slab=forest$SNP, atransf=exp) As does this (setting colors): forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, col=c(1,2,3), slab=forest$SNP, atransf=exp) But if I try to set both 'at' and 'col': forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, col=c(1,2,3), at=log(c(.05, .25, 1, 10)), slab=forest$SNP, atransf=exp) I receive this error: Error in polygon(x = c(alim[2], alim[2] - (1.4/100) * cex * (xlim[2] - : formal argument "col" matched by multiple actual arguments Any help greatly appreciated.
Can you reproduce this using the examples in the package help pages?
David Winsemius, MD Alameda, CA, USA
Good suggestion, and yes, the given examples work. Using a modification of one of the supplied examples, where in the final line I only added the parameter col=c(1,2,3): data(dat.bcg) dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, append=TRUE) forest(dat$yi, dat$vi, slab=paste(dat$author, dat$year, sep=", "), atransf=exp, at=log(c(.05,.25,1,4,20)), col=c(1,2,3)) I get a plot similar to what I want to achieve. My code: forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, col=c(1,2,3), at=log(c(.05, .25, 1, 10)), slab=forest$SNP, atransf=exp) differs in the data and using confidence intervals instead of vi (sample variance). The parameters being changed in my line of code are fairly simple, just color of each row and the x axis tick marks. Setting each of these independently with my data works fine, it's only when I try to do both that it fails. I'm still stuck. Here is some example data that should reproduce the error: SNP Group High Low OR rs1137101 A 1.21 0.87 1.03 rs1137101 B 2.11 1.21 1.6 rs1137101 C 2.9 1.42 2.03 rs1042522 A 1.12 0.84 0.97 rs1042522 B 1.15 0.79 0.95 rs1042522 C 0.92 0.5 0.7 rs1625895 A 1.14 0.76 0.93 rs1625895 B 1.15 0.75 0.93 rs1625895 C NA NA NA ACEI/D A 1.55 0.79 1.11 ACEI/D B 1.25 0.76 0.98 ACEI/D C 0.85 0.41 0.59 -----Original Message----- From: David Winsemius [mailto:dwinsemius at comcast.net] Sent: Sunday, January 06, 2013 2:31 AM To: Brian Z Ring Cc: r-help at r-project.org Subject: Re: [R] package metafor: error when setting 'col' and 'at' for a forest plot
On Jan 4, 2013, at 9:13 PM, Brian Z Ring wrote:
I am using metafor to create forest plots. This code gives me the expected plot (setting x axis tick marks): forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, at=log(c(. 05, .25, 1, 10)), slab=forest$SNP, atransf=exp) As does this (setting colors): forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, col=c(1,2,3), slab=forest$SNP, atransf=exp) But if I try to set both 'at' and 'col': forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, col=c(1,2,3), at=log(c(.05, .25, 1, 10)), slab=forest$SNP, atransf=exp) I receive this error: Error in polygon(x = c(alim[2], alim[2] - (1.4/100) * cex * (xlim[2] - : formal argument "col" matched by multiple actual arguments Any help greatly appreciated.
Can you reproduce this using the examples in the package help pages?
David Winsemius, MD Alameda, CA, USA