Hello,

First, ggplot2 is great!
Second, sorry for the basic nature of my question.

I have data in the form of a melt table like this:
Subject Day     Ab      Variable        Value
1       1       Yes     A       3
1       3       Yes     A       5
1       5       Yes     A       7
2       1       No      A       2
2       3       No      A       4
2       5       No      A       6
3       1       Yes     A       1
3       3       Yes     A       3
3       5       Yes     A       5
4       1       No      A       4
4       3       No      A       6
4       5       No      A       8
1       1       Yes     B       3
1       3       Yes     B       5
1       5       Yes     B       7
2       1       No      B       2
2       3       No      B       4
2       5       No      B       6
3       1       Yes     B       1
3       3       Yes     B       3
3       5       Yes     B       5
4       1       No      B       4
4       3       No      B       6
4       5       No      B       8
1       1       Yes     C       3
1       3       Yes     C       5
1       5       Yes     C       7
2       1       No      C       2
2       3       No      C       4
2       5       No      C       6
3       1       Yes     C       1
3       3       Yes     C       3
3       5       Yes     C       5
4       1       No      C       4
4       3       No      C       6
4       5       No      C       8

The table goes on like this for another 11 subjects.

I can plot a 3 row (A,B,C) x 4 column (Sub 1,2,3,4) grid of time courses with 
the y labels for the facets being 1,2,3,4 and the x labels for the facets being 
A,B,C. 

qplot(Day,Value,data="data above") + facet_grid(Variable~Subject, 
scales="free_y")

But, how do I rearrange the columns so that all the Yeses to Ab are together 
and the Nos to Ab are together while keeping the same labeling?


Thanks in advance.

George Chen

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

Reply via email to