[Rd] (PR#2377)

volker.franz@tuebingen.mpg.de volker.franz@tuebingen.mpg.de
Mon Dec 16 17:31:06 2002


P.s: Sorry, the example got screwed because the lines were longer than
72characters. Here, it is again...
 
######################################################################
library(lattice)
data(barley)

##Simulate standard errors:
barley$variety  <- as.numeric(barley$variety)
barley$yield.se <- abs(rnorm(length(barley$yield),sd=3))

##Print xyplot with errorbars:
print(xyplot(yield ~ variety | site,
data = barley,
groups = year,
ses = barley$yield.se,
type="p",
panel  = function(x,y, ...) {
panel.superpose(x,y, ...)
panel.superpose(x,y,
panel.groups=function(x,y,subscripts,groups,ses,col.symbol,...){
cat("Call to selfdefined panel.groups function by panel.superpose:\n")
cat("  length(x)=          ",length(x),"x=",x,"\n")
cat("  length(y)=          ",length(y),"y=",y,"\n")
cat("  length(groups)=     ",length(groups),"groups=",groups,"\n")
cat("  length(ses)=        ",length(ses),"ses=",ses,"\n")
cat("  subscripts: length=",length(subscripts)," val=",subscripts,"\n")
cat("  groups[subscripts]=",groups[subscripts],"\n")
cat("  ses[subscripts]=   ",ses[subscripts],"\n")
larrows(x,y,x,y+ses[subscripts],col=col.symbol,angle=90,proportion=0.05)
larrows(x,y,x,y-ses[subscripts],col=col.symbol,angle=90,proportion=0.05)
},...)
}))
######################################################################
Volker
--