According to the previous questions answered I thought the following script should work.
require(lattice)
histogram(cyl~mpg|gear*am,
data=mtcars,
nint=5,
panel=function(y,...){
panel.histogram(...)
m<-mean(y)
panel.txt(x=30,y=60,labels=m)
}
)
The histograms plot but I'm getting the "packet 1 argument "y" is missing, with no default"
Help appreciated as I've wasted an hour of my life on this puzzle..