Try reading ?panel.loess. There is no "subset" argument, so it is of course ignored.
-- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Aug 12, 2016 at 9:10 AM, Juan Perez via R-help <r-help@r-project.org> wrote: > Hello, I've created an xyplot and I want to add a loess line for x (Age) > <=40 and another for values >40. In a way it is similar to this > https://stat.ethz.ch/pipermail/r-help/2009-May/390502.html but still not > succcessful. > This is my try: > > xyplot(MOE~Age|Species, groups=Site, > panel = function(x, y, groups=groups,...) { > panel.xyplot(x, y, groups=groups,...) > panel.loess(x,y,subset = x <= 40, col="black") > panel.loess(x,y,subset = x >40, col="red") > }) > When I run the code it "works" but it plots the loess line for all the data, > without subsetting.Any suggestion? > Thank you > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.