[R] need help on forest plot with ggplot

wirichada pan at tropmedres.ac
Fri Sep 30 05:11:29 CEST 2011


Dear R users,

I am trying to do the forest plot follow the function given on web. However,
the order of the tests has been sorted alphabetically. I would prefer
keeping the order as data frame input so that I can group and compare (from
the graph) the target immune NS1, IgG and IgM (where SD, BioRad, Pb etc are
the brand names)

 

> d

                    x        y      ylo      yhi

SD.NS1         SD.NS1 43.23250 38.25736 48.20764

BioRad.NS1 BioRad.NS1 57.31750 54.28494 60.35006

Pb.NS1         Pb.NS1 56.21563 53.14092 59.29033

SD.IgG         SD.IgG 62.26750 60.65677 63.87823

Iq.IgG         Iq.IgG 78.80917 78.34625 79.27209

Merlin.IgG Merlin.IgG 62.46333 60.68995 64.23672

Pb.IgG         Pb.IgG 57.51500 56.94022 58.08978

SD.IgM         SD.IgM 76.90417 75.61221 78.19613

Iq.IgM         Iq.IgM 79.45917 78.73032 80.18801

Merlin.IgM Merlin.IgM 64.50167 60.30376 68.69958

Pb.IgM         Pb.IgM 65.38667 61.81591 68.95742

AFRIMS         AFRIMS 88.29958 84.84922 91.74995

 

I am currently using the code as suggested on web:

 

credplot.gg<- function(d){require(ggplot2)

p <-
ggplot(d,aes(x=x,y=y,ymin=ylo,ymax=yhi))+geom_pointrange()+coord_flip()+

xlab('RDT tests')+ylab('Sensitivity')

return(p)}

 

d <-
data.frame(x=names(ragama.meta)[2:13],y=xx[2:13],ylo=xx[2:13]-1.96*ss[2:13],

yhi=xx[2:13]+1.96*ss[2:13])

credplot.gg(d)

 

How should I correct this so that I can fix the order of the rapid tests the
way I put in.

 

Thank you in advance.

 

Wirichada (Pongtavornpinyo) Pan-ngum

Mathematical Modelling team

Mahidol-Oxford Tropical Medicine Research Unit (MORU) 

Faculty of Tropical Medicine, Mahidol University

420/6 Ratchawithi Rd., Bangkok 10400 Thailand

Tel:  +66 2 203 6322

Fax:  +66 2 354-9169

Email: pan at tropmedres.ac
http://r.789695.n4.nabble.com/file/n3858577/image001.png 

--
View this message in context: http://r.789695.n4.nabble.com/need-help-on-forest-plot-with-ggplot-tp3858577p3858577.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list