Rick DeShon
2006-Nov-06 16:06 UTC
[R] How can you get N replicates of a multi-screen, multivariate time series plot?
Hello All. I would like to repeat a multi-screen, multivariate time series plot across multiple units. Consider the following data: <r-help@stat.math.ethz.ch> UNIT TRIAL Y1 Y2 Y3 Y4 Y5 Y6 1 109 1 NA NA NA 13718 3655 15240 2 109 2 15000 6000 30000 13057 6198 21962 3 109 3 10000 10000 20000 8356 12929 27992 4 109 4 10000 10000 20000 12642 10978 34843 5 109 5 20000 20000 40000 10335 25754 64060 6 109 6 20000 20000 40000 4591 23706 30256 7 109 7 20000 20000 40000 5743 29107 43887 8 109 8 2000 20000 22000 7800 17717 35294 I want to structure this graph to present 3 screens that each represent 2 time series over TRIAL. The following code gives me just what I'm looking for. library(zoo) library(lattice) z <- zoo(data.matrix(ii_df[,3:8]), ii_df[,2]) xyplot(z, screens = c(1, 2, 3, 1, 2, 3), col = 1:6, pch = 1:6, type = "b") This works great. Now, I'd like to repeat this basic graph for 100 levels of UNIT. I have two questions. First, I've tried to replicate this method using a trellis graph without much success. Is there a way to replicate this plot across UNITS using a trellis graph? Second, the trellis graphs I have been able to make result in plots that are too small to read. How could I loop this graphing routine to yield the graph I get above in my zoo code for each of the 100 distinct units? Thanks in advance, Rick -- Rick DeShon 306 Psychology Building Department of Psychology Michigan State University East Lansing, MI 48824-1116 "Prediction is very difficult, especially if it's about the future." --Nils Bohr, [[alternative HTML version deleted]]