Manuel Morales <Manuel.A.Morales <at> williams.edu> writes: > > Sorry. I was thinking of the "groups" functionality, as illustrated > below: > > grps<-rep(c(1:3),10) > x<-rep(c(1:10),3) > y<-x+grps+rnorm(30) > library(lattice) > xyplot(y~x,group=grps, type=c("r","p"))
The points (type "p") are easy, the regression lines (type "r") are a little harder. How about: plot(y~x,col=grps) invisible(mapply(function(z,col) {abline(lm(y~x,data=z),col=col)}, split(data.frame(x,y),grps),1:3)) cheers Ben Bolker ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.