Dear R Gurus!
I would like to generate a multi-panel plot with grouped and reference lines
in each panel .. Example dataset and code are provide below. Where am I
getting wrong in the code below? Any assistance will be highly appreciated.

Thanks so much!
-Santosh
--------start dataset -------
X,l,y1,y2,y3,y4,f
-99,15,0.178,0.127,0.152,0.116,a
0,0,0.218,0.12,0.174,0.145,a
6,0.0015561,0.227,0.122,0.175,0.148,a
11,0.018907,0.213,0.12,0.176,0.145,a
17,0.079668,0.204,0.105,0.153,0.16,a
22,0.2368,0.216,0.121,0.175,0.148,a
27,0.58763,0.217,0.122,0.175,0.148,a
32,1.3433,0.223,0.118,0.17,0.145,a
37,2.7883,0.214,0.115,0.172,0.146,a
42,5.6097,0.22,0.121,0.175,0.147,a
47,11.018,0.216,0.12,0.176,0.145,a
-99,15,0.178,0.127,0.152,0.116,b
4,0.0015561,0.159,0.145,0.114,0.543,b
8,0.018907,0.161,0.145,0.116,0.544,b
12,0.079668,0.143,0.139,0.121,0.539,b
17,0.2368,0.161,0.145,0.114,0.549,b
20,0.58763,0.161,0.145,0.116,0.546,b
25,1.3433,0.162,0.144,0.115,0.556,b
29,2.7883,0.162,0.144,0.115,0.549,b
33,5.6097,0.099,0.1,0.302,0.799,b
37,11.018,0.161,0.144,0.114,0.557,b
--------end dataset -------

library(reshape)
options(scipen=12)
my.settings <-
   list(plot.symbol = list(col = c("red", "blue"), pch = 20,alpha=c(0.8,
0.8)),
        plot.line = list(col = c("red", "blue"), lty = c(2,3)))
x1 <- read.csv(ex1.csv",as.is=T)
y1 <-
melt(x1,measure.vars=names(x1)[3:(length(names(x1))-1)],stringsAsFactors=F)
y1a <- y1[order(y1$f,y1$l),] #
ref <- y1a[y1a$X<0,]

xyplot(value~l|variable,groups=f,main="Compare parameter estimates",
outer=T,allow.mult=T,
        data=y1a[y1a$X>0,],
            strip=strip.custom(strip.names=T,strip.levels=T,var.name="Par"),
            prepanel=function(x,y,group.number,..., horizontal) {
            rngy <- range(y,finite=T)
            rngx <- range(x,finite=T)
           list(ylim=rngy,xlim=rngx)
           },
           panel.superpose,
           panel.xyplot,
          panel.groups = function(x, y, group.number,subscripts=subscripts,
..., horizontal) {
          opar <- trellis.par.get()
          on.exit(trellis.par.set(opar))
          rv <-
ref$value[ref$variable%in%sort(unique(y1$variable))[panel.number()]]
          trellis.par.set(list(plot.symbol =
Rows(my.settings$plot.symbol,group.number),
                plot.line  = Rows(my.settings$plot.line,group.number)))
          panel.xyplot(x, y, horizontal = horizontal)
          panel.abline(h=rv,col='green')
          },
    xlab="Levels",ylab="Values",
          scale=list(x=list(log=T,at=c(0.01,0.1,1,10,15),
          lab=c(0.01,0.1,1,10,15),rot=45),rela="free"),
          auto.key=list(space="bottom",columns=2))

	[[alternative HTML version deleted]]

