[R] plot CI and mortality rate

Ben Bolker bbolker at gmail.com
Wed Oct 20 04:10:46 CEST 2010


XINLI LI <lihawaii <at> gmail.com> writes:

> 
> Dear R Users:
> 
>        I have the individual mortality rate and 95% CI of 100 hospitals,
> how  to do the  plot with the individual hospital in the Yaxis, and the
> mortality rate and 95% CI in the Xais and a overall mean as a reference
> line?

  Something like

library(plotrix)

plotCI(mortratevec,1:n,li=mort.lo,ui=mort.hi,err="x",axes=FALSE)
axis(side=1)
axis(side=2,at=1:n,label=hospitalnames,padj=0,las=1)
box()
abline(v=meanmort)

 
ggplot2 is another option: more complicated to get working,
but very pretty.  You'll want to look at
geom_point
geom_linerange
coord_flip
geom_hline



More information about the R-help mailing list