On Tue, Jul 27, 2010 at 12:41 AM, Deepayan Sarkar <deepayan.sar...@gmail.com> wrote: > On Mon, Jul 26, 2010 at 9:11 PM, Prasenjit Kapat <kap...@gmail.com> wrote: >> Hi, >> >> (please Cc me) >> >> In xyplot (), type = "l" (or one that includes "l", *el*) is >> (generally) meaningful only when the 'x' variable is sorted. In >> practice, one either sorts the data frame before hand or writes a tiny >> panel function which sorts the supplied x and then calls the default >> panel.xyplot(). Trouble arises when there is a conditional variable as >> well as a groups argument. >> >> Before giving a reproducible example, is there anything even simpler >> that I have missed?
[snip] > > Here are two simple enough solutions: > > ## uses panel.average > > xyplot(y ~ x/1000 | C, groups = G, data = D, type = c("p", "a")) > > ## more efficient, as no tapply involved > > panel.xyplot.sorted <- function(x, y, ...) > { > o <- order(x) > panel.xyplot(x[o], y[o], ...) > } > > xyplot(y ~ x/1000 | C, groups = G, data = D, type = "o", > panel = panel.superpose, > panel.groups = panel.xyplot.sorted) > Uh, indeed missed that one! Thanks. -- Prasenjit ______________________________________________ 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.