## I simplified this panel function by taking the calculations outside
## the panel function to allow use of the original variable names.


my.boxpanel3  <-  function(x, y, subscripts, ..., medians, best) { 
  cols <- grey(1-best[,panel.number()]/3)
  panel.bwplot(x, y, fill=cols, ...) 
  panel.abline(h=medians[panel.number()])
}   

td3 <- test.data[test.data$Alg != "R1",]
td3$Alg <- factor(td3$Alg)
levels(td3$Alg)


R1.medians <- with(test.data[test.data$Alg=="R1",], tapply(Value, GOF, median))
A.best <- with(td3, tapply(Value, data.frame(Alg, GOF), median))
A.min <- apply(A.best, 2, function(x) x==min(x))
A.max <- apply(A.best, 2, function(x) x==max(x))
A.best <- cbind(A.min[ ,1:2, drop=FALSE], A.max[ ,3, drop=FALSE])


bwplot(Value ~ Alg | GOF, data = td3, scale=list(relation="free"), 
       as.table=T, layout=c(1,3), panel=my.boxpanel3,
       ylim=list(c(0,1), c(-2,2), c(0,17)),
       medians=R1.medians,
       best=A.best)

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to