[R] how to add point and label to boxplot using bwplot

From: Maria Montez <montez_at_bu.edu>
Date: Fri 02 Jun 2006 - 09:09:01 EST


My data contains information for 10 hospitals for 12 different measures. Let's call it x1-x12. I need to create a boxplot for each one of this measures and put them into one page. Each plot also needs to be independent, i.e. cannot use the group feature because of different scales for each measure. I was successful using the following code:

x1 <- c(1.317604376, 0.978038233, 0.396823901, 0.601130135, 1.039993474, 0.434282156, 0.941604514, 0.84796521, 1.614475852, 2.723760844) c1 <- as.integer(c(9, 9, 2, 7, 10, 1, 11, 49, 26, 5))

plot1 <- bwplot(x1,cex=.5,scales=list(cex=0.5), xlab=list("psi03",cex=.5)) print(plot1,split=c(1,1,1,12),more=TRUE)

#plot2<-bwplot(x2,cex=.5,scales=list(cex=0.5), xlab=list("psi04",cex=.5))

... (code for other 10 plots)

The main purpose is to create one of this pages with information relative to each hospital. So, on each boxplot I need to add a point indicating where that hospital falls with a label that indicates the number of cases regarding that variable. Then I create 10 different pages.

I first tried this without using lattice plots by doing:

boxplot(x1, horizontal=TRUE)
points(x1[4],1,pch=19) #plot point for hospital 2 text(x1[4],0.95,c1[4]) # next to that point indicate number of cases

How can I do the same in a lattice plot? I've tried the following, but it doesn't work (I think I might not be passing the right arguments):

bwplot(x1,cex=.5,scales=list(cex=0.5),tck=0.5, xlab=list("psi03",cex=.5),


Many thanks, Maria

Maria E Montez
Programmer / Data Analyst
Center for Health Quality, Outcomes and Economic Research VA Medical Center
Bedford, MA

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jun 02 15:54:58 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 03 Jun 2006 - 04:10:30 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.