[R] panel function

From: Martin Henry H. Stevens <hstevens_at_muohio.edu>
Date: Wed 21 Dec 2005 - 05:30:21 EST


R v. 2.2.0 on Mac OS 10.4.3
lattice v. 0.12-11

I am trying to add a horizontal panel mean line to a series of panels in a trellis plot (i.e. a horizontal line at the mean of y for each individual panel). I have tried innumerable ways to do this, including the code below, but if it works at all, it merely puts a horizontal line in the last panel.

xyplot(diss ~ Nut-7|Size, data=dathdiss, pch=1, jitter.data=TRUE, panel=function(x,y,...){

	panel.xyplot(x,y)
	panel.abline(a=mean(y),b=0) #This results in the correct line in the  
last panel, but no other lines at all.
	})

Any and all thoughts are appreciated.
Thank you kindly,
Hank

Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243

http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/

"E Pluribus Unum"

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Dec 21 05:54:46 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:40 EST