On 12/18/2009 06:42 AM, changzhu wrote:
I wanted to do a simple plot: Death Rate vs Clinical Site, and then draw a
confidence interval of Death Rate at each clinical site, which is a factor
variable with 100 levels. I used the following code:

plot(Site, Rate, col="red", type="o")

However, the graph was a short line at each site instead of points, and the
color was not red at all. Seem to me for factor variable all options are not
working ! Could anybody help me on how  to draw points at each site, with
specific color? if possible, how to further draw confidence interval at each
site?
Hi Changzu,
Since I don't have Site or Rate, I'll have to be imaginative:

Site<-paste(sample(LETTERS,100,TRUE),
 sample(letters,100,TRUE),sep="")
SiteOrder<-order(Site)
Rate<-runif(100)
plot(as.numeric(factor(Site))[SiteOrder],
 Rate[SiteOrder],col="red",type="o")

Having performed that chicanery, I feel justified in telling you to use the dispersion function in the plotrix package for the CIs, although there are many other similar functions.

Jim

______________________________________________
R-help@r-project.org 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.

Reply via email to