Hi All,
I am quite new to R so my question may seem a bit basic.
I run the below syntax to create a forest plot with sub group analyses.
The forest plot does not display though when I look at the console I see no
error message.
What could be the problem?
### to save as png file
png(filename="forest_plot_with_subgroups.png",
res=95, width=680, height=680, type="cairo")
### decrease margins so the full space is used
par(mar=c(4,4,1,2))
### load BCG vaccine data
syntax <-read.csv(file="I:/ext drive/PhD Wageningen/review-iron metabolism
and snps/new R files/new_rs855791 by HB.csv", header=TRUE, sep=",", dec=".")
View(syntax)
### fit random-effects model (use slab argument to define study labels)
res <- rma.uni(yi=Beta, sei=SE, data=syntax,slab=paste(Author,"(",Year,")",
sep=""), method="REML")
### to specify exactly in which rows the outcomes will be plotted)
forest(syntax.reml,xlab="Beta",xlim=c(-2,1.5),ylim=c(-2,24),order=order(syntax$Ethnicity),showweight=FALSE,efac=3,cex=.9)
op <- par(font=2)
text(-16, c(11,5,2), pos=4, c("Caucasian","Asian","Mixed"))
text(-16, 26, "Author and Year", pos=4)
text(10, 26, "N", pos=2)
text(6, 26, "Beta[SE]", pos=2)
par(op)
op <- par(cex=.75, font=4)
res.s <- rma.uni(yi=Beta, sei=SE,
data=syntax,subset=(Ethnicity=="Caucasian"),method="REML")
res.r <- rma.uni(yi=Beta, sei=SE,
data=syntax,subset=(Ethnicity=="Asian"),method="REML")
res.a <- rma.uni(yi=Beta, sei=SE,
data=syntax,subset=(Ethnicity=="Mixed"),method="REML")
addpoly(res.s, row=18.5, cex=.75, atransf=FALSE, mlab="RE Model for
Subgroup")
addpoly(res.r, row= 7.5, cex=.75, atransf=FALSE, mlab="RE Model for
Subgroup")
addpoly(res.a, row= 1.5, cex=.75, atransf=FALSE, mlab="RE Model for
Subgroup")
--
Wanjiku N Gichohi
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.