Hi,
I am trying to use xyplot to plot the relationship between size and day
(y~x) by a food factor that has two levels, low and high. I have 3 reps per
factor/day.  I want the plots from each food treatment on the same axiss,
so I used this code:

xyplot(Size ~ Day, groups = Food, data = louis.data.means,col=1,
pch=c(1,17),
panel=function(x,y,groups,...){
panel.superpose(x,y,groups,...)
tmp.lm<-lm(y~x)
panel.abline(tmp.lm)
panel.text(2, 250, label=format(tmp.lm$coefficients[2], digits=4), pos=4)
}
)
This produces a graph of the two treatments (open circles for the low food
 vs triangles for the high food) on the same plot, but only one regression
line (and slope)  which seems to splits the difference between the two
factors (treats them as the same data set).  I would like to produce a
separate regression line for the data from each of the two factors (high
food vs low food).

Is there a way to subset the lm by the factor "food"?

Louis

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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