Making Dot Charts in R

Rachel Hayes <rachel.m.hayes@Vanderbilt.Edu> brought a problem to R Clinic on 23Oct08. The Hmisc Dotplot function can produce multi-panel dot charts with error bars while the Hmisc dotchart2 function is useful for showing auxiliary data (e.g., sample sizes) in the right margin.

library(Hmisc)
Load(hayes)
a <- apr

pa <- factor(ifelse(a$peds==0, 'Adult', 'Pediatric'))
dept <- factor(sample(letters[1:30], nrow(a), replace=TRUE))

rdept <- with(a, reorder(dept, oe_dead, mean))
Dotplot(rdept ~ oe_dead | pa, data=a)

with(a,
     dotchart2(oe_dead, auxdata=total_obs,
               auxtitle='N'))
## add another variable with different symbol
  .... add=TRUE, pch=2, ...


## See also ~/doc/teaching/hes/statcomp/Notes/graphscourse.pdf
##          ~/doc/Talks/ACDRS/analysis.r in Frank's files
Topic revision: r2 - 27 Oct 2008, WillGray
 

This site is powered by FoswikiCopyright © 2013-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback