[R] trellis graph question

Greg Tarpinian sasprog474474 at yahoo.com
Wed Mar 29 00:44:12 CEST 2006


R2.2, WinXP:

I am using xyplot( ) to generate time plots of plasma concentration data.
The following is an edited version of my code:

xyplot(log.conc ~ time| group, data = foo,
	groups = subject,
        panel = function(x, y, panel.number, ...)
	{
	 panel.superpose(x, y,
	                 subscripts = TRUE, 
                         groups = foo$group,
	                 type = 'l', col = "black")
	 panel.loess(x,y,span = .66, col = "red", lwd = 3)
         panel.grid(h=-1, v=-1, lwd = 1)
	}
       )

For each dose group, I want to plot all subjects within the group and
superimpose a loess smoother so that an overall trend can be made
apparent.  The code above does this, but has the annoying tendency to
"connect" the first-last points for (say) subject 1 with the last-first
points of (say) subject 2.....

This annoyance is something that is tolerable for exploratory graphs
but not for publication-quality graphs... Is there a "fix" to this
"connect-the-wrong-points" problem?


Much thanks and gratitude in advance,

    Greg




More information about the R-help mailing list