[R] help with longitudinal data plot

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Fri Aug 8 12:10:40 CEST 2008

Dear Robert,

Try ggplot2

ggplot(your.dataframe.name, aes(x = age, y = score, group = subject)) +



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens Robert Terwilliger
Verzonden: vrijdag 8 augustus 2008 0:02
Aan: r-help op r-project.org
Onderwerp: [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.

    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.


Robert Terwilliger

R-help op r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en bindt het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in  this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed bij a duly signed document

More information about the R-help mailing list