Dear collegues,

given a structure of data like this:

###### Data ###########################
set.seed(100)
a <- rnorm(60,10,3)
s <- c(rep("A",20),rep("B",20),rep("C",20))
p <- c(rep("d",6),rep("e",6),rep("f",6),rep("g",6),rep("h",6))
df <- data.frame(a,s,p)

i would like to draw a lattice bwplot in vertical arrangement,
with mean values added.

I tried:

###### Plot 1 ########################
library(lattice)
bwplot(a~p|s,data=df,
panel=function(x,y,...) {
        panel.bwplot(x,y, pch="|",...)
        panel.points(mean(x),y, col="red", ...)
})

However, the mean values are not plotted and it produces warnings.

The analogous code for the horizontal arrangement works well:

###### Plot 2 #########################
bwplot(p~a|s,data=df,
panel=function(x,y,...) {
        panel.bwplot(x,y, pch="|",horizontal=TRUE,...)
        panel.points(mean(x),y, col="red", ...)
})

However, i prefer the vertical arrangement. I have no clue about the 
problem with the code for plot 1.
Can someone help me with modifying the code for Plot 1 accordingly?

Thanks, Henning
    

	[[alternative HTML version deleted]]

