Santosh
2009-Dec-31 11:25 UTC
[R] xyplot - help with multiple Y's vs. X of a member data in multiple panels
Dear R experts, Wish you all a HAPPY NEW YEAR! How do I go about plotting (using lattice) overlays of an ID (group=ID) observed, fitted data in each panel of a multiple panel plot (each panel identified by DS1 + DS2 + DS3)? "x" variable is X1 in the accompanying section of a dataset. each individual is identified by color and Y's are identified by "pch" or "lty". I guess the code goes something like the one below, but could not get the proper use of panel functions.... xyplot(Y1+Y2+Y3~X1|DS1+DS2+DS3,data=d1,group=ID,...) A sample section of the data is given below.. DS3,DS2,DS1,ID,X1,TYPE,Y1,Y2,Y3 1,1,1,1,6.087,1,1.81,1.64,1.82 1,1,1,1,6.337,1,2.61,2.48,2.56 1,1,1,1,6.837,1,3.14,3.10,3.08 1,1,1,1,7.837,1,3.39,3.50,3.36 1,1,1,1,8.837,1,3.34,3.62,3.39 1,1,1,1,9.837,1,3.27,3.63,3.34 1,1,1,1,10.837,1,3.25,3.59,3.25 1,1,1,1,12.862,1,2.96,3.44,3.04 1,1,1,1,15.837,1,2.72,3.15,2.68 1,1,1,1,19.844,1,2.21,2.69,2.18 1,1,1,1,26.837,1,1.29,1.79,1.28 1,1,1,1,33.858,1,0.40,0.88,0.41 1,1,1,1,40.886,1,-0.43,0.03,-0.41 1,0.1,1,2,8.092,1,0.03,-0.67,0.04 1,0.1,1,2,8.342,1,0.78,0.14,0.57 1,0.1,1,2,8.842,1,0.90,0.71,0.84 1,0.1,1,2,9.842,1,0.79,1.00,0.84 1,0.1,1,2,10.842,1,0.76,1.02,0.73 1,0.1,1,2,11.842,1,0.45,0.95,0.60 1,0.1,1,2,12.842,1,0.37,0.86,0.48 1,0.1,1,2,14.873,1,0.07,0.63,0.24 1,0.1,1,2,17.842,1,-0.21,0.29,-0.10 1,0.1,1,2,21.842,1,-0.17,-0.15,-0.52 1,0.1,1,3,7.208,1,-0.22,-0.77,-0.15 1,0.1,1,3,7.458,1,0.70,0.03,0.53 1,0.1,1,3,7.958,1,0.98,0.60,0.90 1,0.1,1,3,8.958,1,0.83,0.89,0.93 1,0.1,1,3,9.958,1,0.73,0.91,0.79 1,0.1,1,3,10.958,1,0.65,0.84,0.63 1,0.1,1,3,11.958,1,0.37,0.75,0.46 1,0.1,1,3,13.958,1,0.26,0.53,0.14 1,0.1,1,3,16.958,1,-0.34,0.19,-0.32 1,0.1,1,4,7.305,1,-1.09,0.24,-1.16 1,0.1,1,4,7.805,1,-0.61,0.80,-0.44 1,0.1,1,4,8.805,1,-0.03,1.10,0.04 1,0.1,1,4,9.805,1,0.14,1.12,0.20 1,0.1,1,4,10.805,1,0.26,1.05,0.25 1,0.1,1,4,11.805,1,0.28,0.96,0.25 1,0.1,1,4,13.817,1,0.30,0.73,0.18 1,0.1,1,4,16.805,1,0.10,0.39,-0.01 1,0.1,1,4,20.805,1,-0.47,-0.06,-0.31 1,0.1,1,5,8.307,1,-0.36,0.03,-0.48 1,0.1,1,5,8.807,1,-0.17,0.60,-0.02 1,0.1,1,5,9.807,1,0.05,0.89,0.17 1,0.1,1,5,10.807,1,0.18,0.91,0.14 1,0.1,1,5,11.807,1,0.03,0.84,0.06 1,0.1,1,5,12.807,1,0.10,0.75,-0.04 1,0.1,1,5,14.817,1,-0.28,0.53,-0.26 0,0.1,1,5,17.807,1,-0.65,0.19,-0.60 0,0.1,1,6,6.133,1,-0.41,-0.67,-0.42 0,0.1,1,6,6.383,1,0.41,0.14,0.55 0,0.1,1,6,6.883,1,1.36,0.71,1.21 0,0.1,1,6,7.883,1,1.52,1.00,1.44 0,0.1,1,6,8.883,1,1.40,1.02,1.33 0,0.1,1,6,9.883,1,1.05,0.95,1.12 0,0.1,1,6,10.883,1,0.91,0.86,0.89 0,0.1,1,6,12.89,1,0.42,0.63,0.44 0,0.1,1,6,15.883,1,-0.19,0.29,-0.14 1,5,1,7,9.983,1,3.27,3.02,3.20 1,5,1,7,10.233,1,3.94,3.88,3.87 1,5,1,7,10.733,1,4.35,4.54,4.40 1,5,1,7,11.733,1,4.68,5.00,4.76 1,5,1,7,12.733,1,4.87,5.16,4.87 1,5,1,7,13.733,1,4.80,5.21,4.91 1,5,1,7,14.733,1,4.97,5.22,4.92 1,5,1,7,16.733,1,4.87,5.16,4.90 1,5,1,7,19.754,1,4.72,5.02,4.82 1,5,1,7,23.733,1,4.67,4.78,4.68 1,5,1,7,30.733,1,4.31,4.29,4.35 1,5,1,7,37.733,1,4.01,3.68,3.90 1,5,1,7,44.733,1,3.40,2.92,3.31 1,5,1,7,51.749,1,2.53,2.01,2.52 1,5,1,7,58.733,1,1.57,1.10,1.57 1,5,1,7,65.733,1,0.54,0.23,0.62 1,5,1,7,72.733,1,-0.23,-0.54,-0.24 1,5,1,7,79.733,1,-1.03,-1.14,-0.94 Please let me know if you need additional info. Thanks, Santosh [[alternative HTML version deleted]]
jim holtman
2010-Jan-01 02:59 UTC
[R] xyplot - help with multiple Y's vs. X of a member data in multiple panels
I am not too sure if this is what you are after, but I just created a new factor for the panel: # create a new factor d1$newFactor <- factor(paste(d1$DS1, "+", d1$DS2, "+", d1$DS3)) xyplot(Y1+Y2+Y3~X1|newFactor,data=d1,group=ID) On Thu, Dec 31, 2009 at 6:25 AM, Santosh <santosh2005@gmail.com> wrote:> Dear R experts, > Wish you all a HAPPY NEW YEAR! > > How do I go about plotting (using lattice) overlays of an ID (group=ID) > observed, fitted data in each panel of a multiple panel plot (each panel > identified by DS1 + DS2 + DS3)? "x" variable is X1 in the accompanying > section of a dataset. each individual is identified by color and Y's are > identified by "pch" or "lty". > > I guess the code goes something like the one below, but could not get the > proper use of panel functions.... > > xyplot(Y1+Y2+Y3~X1|DS1+DS2+DS3,data=d1,group=ID,...) > > A sample section of the data is given below.. > DS3,DS2,DS1,ID,X1,TYPE,Y1,Y2,Y3 > 1,1,1,1,6.087,1,1.81,1.64,1.82 > 1,1,1,1,6.337,1,2.61,2.48,2.56 > 1,1,1,1,6.837,1,3.14,3.10,3.08 > 1,1,1,1,7.837,1,3.39,3.50,3.36 > 1,1,1,1,8.837,1,3.34,3.62,3.39 > 1,1,1,1,9.837,1,3.27,3.63,3.34 > 1,1,1,1,10.837,1,3.25,3.59,3.25 > 1,1,1,1,12.862,1,2.96,3.44,3.04 > 1,1,1,1,15.837,1,2.72,3.15,2.68 > 1,1,1,1,19.844,1,2.21,2.69,2.18 > 1,1,1,1,26.837,1,1.29,1.79,1.28 > 1,1,1,1,33.858,1,0.40,0.88,0.41 > 1,1,1,1,40.886,1,-0.43,0.03,-0.41 > 1,0.1,1,2,8.092,1,0.03,-0.67,0.04 > 1,0.1,1,2,8.342,1,0.78,0.14,0.57 > 1,0.1,1,2,8.842,1,0.90,0.71,0.84 > 1,0.1,1,2,9.842,1,0.79,1.00,0.84 > 1,0.1,1,2,10.842,1,0.76,1.02,0.73 > 1,0.1,1,2,11.842,1,0.45,0.95,0.60 > 1,0.1,1,2,12.842,1,0.37,0.86,0.48 > 1,0.1,1,2,14.873,1,0.07,0.63,0.24 > 1,0.1,1,2,17.842,1,-0.21,0.29,-0.10 > 1,0.1,1,2,21.842,1,-0.17,-0.15,-0.52 > 1,0.1,1,3,7.208,1,-0.22,-0.77,-0.15 > 1,0.1,1,3,7.458,1,0.70,0.03,0.53 > 1,0.1,1,3,7.958,1,0.98,0.60,0.90 > 1,0.1,1,3,8.958,1,0.83,0.89,0.93 > 1,0.1,1,3,9.958,1,0.73,0.91,0.79 > 1,0.1,1,3,10.958,1,0.65,0.84,0.63 > 1,0.1,1,3,11.958,1,0.37,0.75,0.46 > 1,0.1,1,3,13.958,1,0.26,0.53,0.14 > 1,0.1,1,3,16.958,1,-0.34,0.19,-0.32 > 1,0.1,1,4,7.305,1,-1.09,0.24,-1.16 > 1,0.1,1,4,7.805,1,-0.61,0.80,-0.44 > 1,0.1,1,4,8.805,1,-0.03,1.10,0.04 > 1,0.1,1,4,9.805,1,0.14,1.12,0.20 > 1,0.1,1,4,10.805,1,0.26,1.05,0.25 > 1,0.1,1,4,11.805,1,0.28,0.96,0.25 > 1,0.1,1,4,13.817,1,0.30,0.73,0.18 > 1,0.1,1,4,16.805,1,0.10,0.39,-0.01 > 1,0.1,1,4,20.805,1,-0.47,-0.06,-0.31 > 1,0.1,1,5,8.307,1,-0.36,0.03,-0.48 > 1,0.1,1,5,8.807,1,-0.17,0.60,-0.02 > 1,0.1,1,5,9.807,1,0.05,0.89,0.17 > 1,0.1,1,5,10.807,1,0.18,0.91,0.14 > 1,0.1,1,5,11.807,1,0.03,0.84,0.06 > 1,0.1,1,5,12.807,1,0.10,0.75,-0.04 > 1,0.1,1,5,14.817,1,-0.28,0.53,-0.26 > 0,0.1,1,5,17.807,1,-0.65,0.19,-0.60 > 0,0.1,1,6,6.133,1,-0.41,-0.67,-0.42 > 0,0.1,1,6,6.383,1,0.41,0.14,0.55 > 0,0.1,1,6,6.883,1,1.36,0.71,1.21 > 0,0.1,1,6,7.883,1,1.52,1.00,1.44 > 0,0.1,1,6,8.883,1,1.40,1.02,1.33 > 0,0.1,1,6,9.883,1,1.05,0.95,1.12 > 0,0.1,1,6,10.883,1,0.91,0.86,0.89 > 0,0.1,1,6,12.89,1,0.42,0.63,0.44 > 0,0.1,1,6,15.883,1,-0.19,0.29,-0.14 > 1,5,1,7,9.983,1,3.27,3.02,3.20 > 1,5,1,7,10.233,1,3.94,3.88,3.87 > 1,5,1,7,10.733,1,4.35,4.54,4.40 > 1,5,1,7,11.733,1,4.68,5.00,4.76 > 1,5,1,7,12.733,1,4.87,5.16,4.87 > 1,5,1,7,13.733,1,4.80,5.21,4.91 > 1,5,1,7,14.733,1,4.97,5.22,4.92 > 1,5,1,7,16.733,1,4.87,5.16,4.90 > 1,5,1,7,19.754,1,4.72,5.02,4.82 > 1,5,1,7,23.733,1,4.67,4.78,4.68 > 1,5,1,7,30.733,1,4.31,4.29,4.35 > 1,5,1,7,37.733,1,4.01,3.68,3.90 > 1,5,1,7,44.733,1,3.40,2.92,3.31 > 1,5,1,7,51.749,1,2.53,2.01,2.52 > 1,5,1,7,58.733,1,1.57,1.10,1.57 > 1,5,1,7,65.733,1,0.54,0.23,0.62 > 1,5,1,7,72.733,1,-0.23,-0.54,-0.24 > 1,5,1,7,79.733,1,-1.03,-1.14,-0.94 > > Please let me know if you need additional info. > > Thanks, > Santosh > > [[alternative HTML version deleted]] > > ______________________________________________ > 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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]