[R] help with longitudinal data plot

Bert Gunter gunter.berton at gene.com
Fri Aug 8 00:28:39 CEST 2008


try xyplot() in lattice

Something like:

xyplot(score ~age, group = subject,data = your frame, type= "b") 

-- Bert Gunter

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Robert Terwilliger
Sent: Thursday, August 07, 2008 3:02 PM
To: r-help at r-project.org
Subject: [R] help with longitudinal data plot

Dear R Help,

I am attempting to make a plot of longitudinal data, a sample data
frame of which is shown below.

I'd like to show all of the subjects in the same plot, with a set of
connecting line segments for each subject. 'age' would be the x-axis
and 'score' would be the y-axis.

n    subject age  score
1     10123  12  51.06
2     10123  14  50.00
3     10123  15  62.22
4     10124  12  74.42
5     10124  13  72.73
6     10124  14  63.41
7     10125  16  54.55
8     10125  17  50.00
9     10125  18  54.35
10    10128  17  97.83
11    10128  18  97.87
12    10128  19 100.00
...

Any help would be appreciated.

Regards,

Robert Terwilliger

______________________________________________
R-help at 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.



More information about the R-help mailing list