Try sample() which will allow you to randomly select 10 ID's from your ID variable, which you can then plot.

Andrew Miles


On Dec 16, 2010, at 10:49 AM, Rasanga Ruwanthi wrote:

Hi

I am using following code to produce a xyplot for some longitudinal data. There are 2 panels. It produced all longitudinal trajectories with mean profile. But since the dataset it very large plot looks very messy. I want to show, say 10 randomly selected individual longitudinal trajectories together with mean profile for entire dataset. Could any help me to alter the following code to do this? or is there an alternative way?

Thanks in advance.

xyplot(Y~ time|status,groups=ID,data=heart,
type="l",lty=1, layout=c(2,1),main="",
panel = function (x, y, subscripts, groups, ...) {
panel.superpose (x, y, panel.groups = "panel.xyplot",subscripts,groups, ...)
panel.loess (x, y, col = "Red", lwd = 2,span=0.75, ...)
})




        [[alternative HTML version deleted]]

______________________________________________
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.

______________________________________________
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.
  • [R] xyplot Rasanga Ruwanthi
    • Re: [R] xyplot Andrew Miles

Reply via email to