Re: [R] graphics - joining repeated measures with a line

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 07 Sep 2006 - 02:01:30 GMT

Just one correction (although in this case it does not change the output) -- use group = patient rather than group = symbol[patient]:

xyplot(var ~ visit, group = patient, type = "b", auto.key = list(space = "right"),

   par.settings = list(superpose.symbol = list(pch = symbols)))

On 9/6/06, Gabor Grothendieck <ggrothendieck@gmail.com> wrote:
> Make each pair of points a separate group using group= and specify
> that both points and lines be used via type = "b". Also set the
> symbols in par.settings= so that they are accessed by both
> the main plot and the legend:
>
> xyplot(var ~ visit, group = symbols[patient], type = "b",
> auto.key = list(space = "right"),
> par.settings = list(superpose.symbol = list(pch = symbols)))
>
>
> On 9/6/06, Murray Pung <mcpung@gmail.com> wrote:
> > I would like to join repeated measures for patients across two visits using
> > a line. The program below uses symbols to represent each patient. Basically,
> > I would like to join each pair of symbols.
> >
> >
> >
> > library(lattice)
> >
> > patient <- c(1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9)
> > var <-
> > c(826,119,168,90,572,323,122,10,42,900,250,180,120,650,400,130,12,33)
> > visit <- c(1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2)
> > symbols <- c(1,2,3,4,5,6,7,8,9)
> >
> > xyplot(var ~ visit, pch = symbols[patient], key = list(points = list(pch =
> > symbols), space = list("right"),text =
> > list(c("1","2","3","4","5","6","7","8","9"))))
> >
> > # grid.lines(x = visit,y = var,draw = TRUE) ??
> >
> > I am thinking I may need to use a function that joins coordinates (for
> > example join (1,826) with (2,900)), but am hoping there may be a better way.
> >
> >
> >
> > Thanks for any help.
> >
> > Murray
> >
> >
> > --
> > Murray Pung
> > Statistician, Datapharm Australia Pty Ltd
> > 0404 273 283
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
> >
>



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. Received on Thu Sep 07 12:05:38 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 07 Sep 2006 - 07:51:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.