install.packages("rmeta") library(rmeta) data(cochrane) svg("cochrane_logo_data.svg",width=9,height=4.35) steroid <- meta.MH(n.trt, n.ctrl, ev.trt, ev.ctrl, names=name, data=cochrane) tabletext<-cbind( c("","Study",steroid$names,NA,"Summary"), #Just tags, not single-author papers # c("","Year",c(1111,1111,1111,1111,1111,1111,1111),NA,NA), #Don't have this data c("Deaths","(corticosteroid)",cochrane$ev.trt,NA,NA), c("Deaths","(placebo)", cochrane$ev.ctrl, NA,NA), c("","Odds ratio",format(exp(steroid$logOR),digits=2),NA,format(exp(steroid$logMH),digits=2)) ) m<- c(NA,NA,steroid$logOR,NA,steroid$logMH) #Mean l<- m-c(NA,NA,steroid$selogOR,NA,steroid$selogMH)*2 #Lower u<- m+c(NA,NA,steroid$selogOR,NA,steroid$selogMH)*2 #Upper forestplot(tabletext,m,l,u,zero=0,is.summary=c(TRUE,TRUE,rep(FALSE,8),TRUE), clip=c(log(0.015),log(3)), xlog=TRUE, xticks=c(0.01,0.1,1,2,4), col=meta.colors(box="royalblue",line="darkblue", summary="royalblue")) forestplot(tabletext,m,l,u,zero=0,is.summary=c(TRUE,TRUE,rep(FALSE,8),TRUE), clip=c(log(0.015),log(3)), xlog=TRUE, #boxsize=0.75, xticks=c(0.01,0.1,1,2,4), xlab="\nOdds ratio with 95% confidence interval\n(1=no effect, <1=treatment has fewer deaths)", col=meta.colors(box="royalblue",line="darkblue", summary="royalblue")) dev.off()