[R] How do I plot geoms in parallel in ggplot

George Chen glchen at stanford.edu
Thu May 6 20:06:44 CEST 2010


Hello,

I am new to ggplot.  Please forgive my ignorance!

I have patient data such that each individual is a row and then the attributes are in columns.  So for example:

Subj        Time        Height        Weight        WBC        Plt
1        1        9        4        4        150
1        2        10        5        6        200
1        3        11        6        5        250
1        4        12        7        3        200
2        1        4        2        7        300
2        2        5        4        8        450
2        3        6        6        6        300
2        4        8        8        5        200
3        1        6        6        4        455
3        2        8        8        5        344
3        3        9        9        6        544
3        4        10        10        3        213

I would like to show the data as a time course for height , weight, WBC, and plt for each patient but in parallel and ultimately as a matrix of time courses for all the subjects with each patient a row and the time course graph for height weight WBC plt as individual columns.

So something like this
Subj 1   Height time course(TC)   Weight TC    WBC TC    Plt TC
Subj 2   Height time course(TC)   Weight TC    WBC TC    Plt TC
Subj 3   Height time course(TC)   Weight TC    WBC TC    Plt TC

Ultimately I would like to be able to sort and reorder the order of the subject rows (so each row would become like a facet).
Could somebody give me a hint as to how or where to start looking to figure this out?  I suspect it involves a layer for each time course, but how does one move the time course for say weight over so that it does not overly that for height?

Thanks in advance!

George



More information about the R-help mailing list