[R] question on xyplot

From: Zhongming Yang <zhongmingyang_at_yahoo.com>
Date: Wed 16 Mar 2005 - 05:58:13 EST


Dear All:  

In the attached file, I have 3 group patients, and there are 5 in each group (the groups are decided by the prefix of the idno). I want draw a repeat measurement comparison figure. My goal is to list 5 patients from same group on one horizontal line. But xyplot sounds pick them randomly (or I was confused?). Could you please help me modify the following code to accomplish this?  

Thanks  

Zhongming Yang  

library(nlme)
library(lattice)
md <- read.table('../data/sample.txt', header=T) md <- groupedData(md ~ month | idno, data=md)
trellis.device(theme=col.whitebg())
xyplot(md ~ month | idno, data=md, main="title",

   xlab="x", ylab="y", layout=c(5, 3),
   panel=function(x, y){
   panel.xyplot(x, y)
   panel.lmline(x, y, lty=2)

        }
   )                   


      md idno month
-7.705 NN_533 0.000000
-5.880 NN_533 3.254795
-5.850 NN_533 6.049315
-5.700 NN_533 8.876712
-6.470 NN_533 11.967123
-8.240 NN_533 14.958904
-7.180 NN_533 18.673973
-5.200 NN_533 21.501370
-8.180 NN_533 25.380822

 -10.130 NN_533 28.303077 

-6.750 NN_533 31.057175
-7.190 NN_533 33.647339
-6.410 NN_533 36.630945
-7.640 NN_533 39.616438
-9.820 NN_533 42.772603
-6.260 NN_533 45.534247
-5.580 NN_533 48.131507
-6.350 NN_533 51.747945
-7.380 NN_533 57.534247
-5.780 NN_533 60.723288
-7.130 NN_533 64.931507
-9.440 NN_533 70.389041
-3.885 NN_577 0.000000
-5.990 NN_577 3.221918
-4.610 NN_577 5.983562
-5.680 NN_577 9.205479
-6.410 NN_577 11.736986
-6.050 NN_577 16.338828
-4.990 NN_577 19.092926
-5.760 NN_577 21.617516
-6.050 NN_577 24.601123
-4.900 NN_577 27.584729
-6.690 NN_577 30.575342
-5.460 NN_577 33.567123
-4.840 NN_577 36.558904
-6.280 NN_577 39.550685
-5.090 NN_577 42.542466
-5.700 NN_577 46.684932
-5.280 NN_577 52.208219
-6.330 NN_577 54.739726
-5.650 NN_577 57.271233
-6.130 NN_577 61.347945
-6.130 NN_577 65.027352
-4.930 NN_577 69.945385
-6.650 NN_577 73.355221
-6.680 NN_577 76.339726
-6.130 NN_577 79.561644
-7.090 NN_577 82.093151
-6.680 NN_577 86.268493
-7.210 NN_577 92.876712
-7.290 NN_577 96.723288
-6.530 NN_619 0.000000
-10.090 NN_619 3.452055
-7.220 NN_619 6.274062
-8.220 NN_619 9.815046
-8.820 NN_619 12.634718
-6.210 NN_619 15.552751
-6.750 NN_619 18.772603
-7.020 NN_619 21.304110
-6.700 NN_619 23.901370
-6.170 NN_619 26.663014
-5.890 NN_619 29.884932
-6.110 NN_619 32.876712
-5.530 NN_619 36.493151
-6.510 NN_619 39.254795
-6.630 NN_619 42.082192
-6.760 NN_619 44.843836
-7.620 NN_619 48.000000
-6.490 NN_619 50.991781
-5.340 NN_619 54.437997
-5.530 NN_619 57.880620
-6.710 NN_619 60.470784
-8.130 NN_619 62.995374
-4.830 NN_619 66.838356
-5.610 NN_619 69.600000
-5.720 NN_619 72.131507
-6.440 NN_619 75.419178
-5.870 NN_619 78.378082
-5.130 NN_619 81.830137
-8.990 NN_619 84.821918
-6.260 NN_619 90.345205
-5.320 NN_619 96.789041
-2.085 NN_675 0.000000
-2.610 NN_675 2.761644
-2.710 NN_675 6.904110
-1.560 NN_675 9.205479
-1.590 NN_675 12.197260
-0.950 NN_675 14.958904
-0.660 NN_675 19.791781
-0.630 NN_675 23.967123
-0.380 NN_675 26.695890
-0.930 NN_675 31.528767
-2.570 NN_675 34.323288
-3.030 NN_675 36.621603
-0.750 NN_675 39.801931
0.320 NN_675 43.244554 0.640 NN_675 45.769144 0.420 NN_675 48.986301 0.180 NN_675 51.978082 0.500 NN_675 54.969863 0.700 NN_675 57.961644 0.050 NN_675 60.460274
-0.100 NN_675 63.024658
-0.050 NN_675 69.665753
-0.250 NN_675 72.887671
-1.050 NN_675 80.646575
-2.090 NN_675 86.260948
-5.195 NN_833 0.000000
-4.640 NN_833 3.180328
-10.275 TP_549 0.000000 -15.520 TP_549 3.484932 -15.080 TP_549 6.443836 -19.900 TP_549 9.468493 -19.290 TP_549 14.301370 -20.450 TP_549 19.134247 -19.090 TP_549 22.356164 -20.410 TP_549 24.885426 -19.980 TP_549 28.098540 -20.250 TP_549 33.606737 -18.830 TP_549 36.361644 -19.600 TP_549 39.945205 -19.840 TP_549 43.200000 -20.870 TP_549 46.257534 -20.150 TP_549 49.249315 -21.130 TP_549 52.241096 -20.800 TP_549 54.871233 -23.300 TP_549 57.534247 -21.130 TP_549 60.526027 -22.350 TP_549 64.898630 -21.970 TP_549 69.501370 -21.900 TP_549 72.721491 -22.130 TP_549 76.360835 -22.100 TP_549 79.803458 -24.000 TP_549 83.934606 -22.450 TP_549 88.306849 -25.190 TP_549 97.019178 -23.420 TP_549 99.583562 -13.560 TP_603 0.000000 -15.670 TP_603 3.452055 -13.410 TP_603 6.904110 -15.560 TP_603 9.857804 -12.090 TP_603 13.103705 -14.020 TP_603 15.628296 -15.080 TP_603 18.382394 -16.540 TP_603 21.139726 -13.590 TP_603 24.328767 -16.130 TP_603 28.043836 -14.720 TP_603 31.167123 -12.300 TP_603 33.567123 -15.490 TP_603 36.361644 -16.650 TP_603 40.241096 -17.670 TP_603 43.002740 -15.020 TP_603 46.454795 -14.490 TP_603 49.446575 -18.500 TP_603 54.542466 -13.910 TP_603 56.939771 -18.620 TP_603 61.169279 -18.600 TP_603 64.087312 -20.420 TP_603 67.300427 -18.450 TP_603 70.389041 -19.830 TP_603 72.920548 -19.190 TP_603 78.871233 -18.630 TP_603 84.821918 -10.215 TP_642 0.000000 -12.900 TP_642 2.983607 -12.930 TP_642 5.967213
-7.810 TP_642 9.409836
-7.560 TP_642 11.706265
-12.060 TP_642 15.585717
-9.200 TP_642 19.300786
-9.200 TP_642 22.193937
-11.330 TP_642 24.824074 -14.500 TP_642 28.045991 -11.280 TP_642 30.807635 -13.210 TP_642 34.029553 -11.280 TP_642 37.021334 -15.120 TP_642 39.782978 -13.620 TP_642 43.235033 -13.300 TP_642 45.799416 -15.580 TP_642 48.327869 -11.590 TP_642 50.590164 -14.910 TP_642 54.950820 -12.660 TP_642 57.704918 -16.610 TP_642 60.922704 -16.310 TP_642 63.684348 -16.110 TP_642 66.610375 -20.070 TP_642 69.898046 -13.850 TP_642 72.889827 -18.260 TP_642 75.914485 -16.520 TP_642 79.070649 -15.050 TP_642 85.054211 -14.830 TP_642 92.122704
-3.485 TP_842 0.000000
-3.770 TP_842 3.214821
-2.610 TP_842 5.779205
-3.060 TP_842 9.231260
-2.730 TP_842 11.960027
-2.650 TP_842 15.280575
-1.500 TP_842 17.713452
-3.120 TP_842 20.770986
-3.490 TP_842 24.157287
-3.210 TP_842 27.379205
-3.810 TP_842 30.370986
-3.100 TP_842 32.277835
-4.040 TP_842 35.894274
-3.150 TP_842 40.262295
-3.060 TP_842 42.163934
-5.270 TP_842 44.196721
-4.450 TP_842 48.098361
-2.460 TP_842 51.642219
-2.970 TP_842 53.812082
-3.800 TP_842 55.981945
-3.080 TP_842 59.828520
-2.500 TP_842 63.247698
-3.270 TP_842 67.390164
-2.540 TP_842 70.447698
-4.330 TP_842 72.058657
-4.390 TP_842 75.444958
-3.740 TP_842 79.127150
-4.410 TP_842 81.987424
-5.970 TP_842 85.176465
2.395 TP_855 0.000000 1.990 TP_855 2.728767 1.790 TP_855 5.950685 1.380 TP_855 9.402740 1.230 TP_855 11.901370 1.130 TP_855 15.123288 1.880 TP_855 18.180822 1.350 TP_855 20.679452 0.960 TP_855 23.868493 1.620 TP_855 26.695890 0.780 TP_855 29.720548 1.340 TP_855 32.679452 1.230 TP_855 35.141882 2.970 TP_855 39.076308 0.570 TP_855 41.830406 1.050 TP_855 45.502538 1.110 TP_855 48.263014 0.090 TP_855 50.169863 2.160 TP_855 54.246575 0.030 TP_855 56.745205 1.460 TP_855 60.230137 1.540 TP_855 62.531507 2.180 TP_855 65.983562 1.680 TP_855 68.153425 2.950 TP_855 71.736986 2.230 TP_855 78.871233 0.720 TP_855 84.682865
-3.300 SN_594 0.000000
-3.550 SN_594 3.221918
-5.580 SN_594 5.753425
-4.020 SN_594 9.501370
-2.550 SN_594 12.192230
-3.370 SN_594 15.470918
-5.730 SN_594 18.388951
-1.640 SN_594 21.438132
-5.270 SN_594 24.427397
-1.990 SN_616 0.000000
-2.430 SN_616 4.043836
-2.280 SN_616 6.340175
-3.400 SN_616 9.881159
-2.420 SN_616 13.094274
-3.810 SN_616 15.618864
-2.730 SN_616 18.378082
-1.650 SN_616 21.830137
-4.190 SN_616 25.282192
-2.700 SN_616 28.043836
-2.610 SN_616 31.035616
-2.530 SN_616 33.336986
-2.410 SN_616 37.249315
-3.700 SN_616 40.010959
-3.140 SN_616 42.772603
-3.100 SN_616 45.304110
-2.420 SN_616 49.841096
-1.600 SN_616 53.389355
-2.740 SN_616 56.799192
-2.950 SN_616 60.930339
-4.670 SN_616 64.143454
-2.420 SN_616 66.673973
-2.500 SN_616 69.698630
-4.810 SN_616 73.347945
-4.680 SN_616 75.879452
-3.780 SN_616 79.101370
-2.870 SN_616 82.060274
-2.930 SN_616 86.663014
-7.230 SN_616 89.884932
-3.780 SN_616 97.643836
-0.265 SN_673 0.000000
-0.890 SN_673 3.876937
1.480 SN_673 5.915293 0.800 SN_673 9.202964 1.260 SN_673 11.931731 1.330 SN_673 14.726252 2.010 SN_673 17.027622 1.300 SN_673 21.400225 1.720 SN_673 23.931731 1.760 SN_673 26.660499 1.780 SN_673 29.685156 1.210 SN_673 32.907074 1.150 SN_673 35.898855 1.200 SN_673 39.540984 0.780 SN_673 41.868852 1.240 SN_673 45.475410 2.010 SN_673 48.983786 1.600 SN_673 52.402964 1.880 SN_673 53.750909 1.470 SN_673 57.564608 1.560 SN_673 59.865978 1.400 SN_673 63.482416 1.630 SN_673 65.718033 2.550 SN_673 70.846800 0.950 SN_673 78.671457
-0.360 SN_673 84.194745
-7.610 SN_683 0.000000
-5.940 SN_683 3.419178
-6.270 SN_683 6.641096
-6.230 SN_683 10.093151
-4.210 SN_683 12.854795
-5.360 SN_683 15.649315
-4.300 SN_683 18.871233
-6.240 SN_683 22.290411
-5.010 SN_683 25.084932
-6.400 SN_683 28.306849
-6.670 SN_683 31.068493
-5.870 SN_683 34.060274
-6.510 SN_683 36.586481
-2.975 SN_828 0.000000
-2.990 SN_828 2.983607
-3.990 SN_828 6.885246
-2.620 SN_828 9.184011
-1.380 SN_828 11.945655
-2.230 SN_828 14.510038
-2.080 SN_828 17.699079
-2.410 SN_828 21.611408
-3.290 SN_828 24.175792
-1.980 SN_828 27.134696
-1.970 SN_828 29.929216
-2.450 SN_828 32.263463
-2.390 SN_828 36.603189
-0.950 SN_828 39.134696
-2.490 SN_828 41.896340
2.550 SN_828 44.950820
-3.120 SN_828 48.163934
-0.300 SN_828 52.295082
-2.730 SN_828 54.262295
-3.230 SN_828 57.808668
-1.780 SN_828 60.110038
-2.370 SN_828 63.430586
-3.140 SN_828 65.863463
-2.730 SN_828 69.315518
-1.830 SN_828 71.715518
-2.460 SN_828 75.167572
-2.770 SN_828 77.830586
-2.690 SN_828 84.142915
-2.890 SN_828 90.126477



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Mar 16 06:05:17 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:48 EST