[R] lattice: strip panel function question

Maarten van Iterson M.van_iterson.HG at lumc.nl
Mon Dec 6 09:32:29 CET 2010

Dear list, 

If have some repeated measurement data which looks something like: 

time <- rep(1:5 , each=2*4)
groups <- rep(c("Case", "Control"), each=4)
subjects <- factor(rep(1:(2*4), 5))
responses <- time + rnorm(5*2*4) + as.integer(factor(groups))
data <- data.frame(responses, time, groups, subjects)

Now I want to plot each subject in a separate panel:

xyplot(responses~time|subjects*groups, data = data, aspect="xy")

but this introduces empty panels. I tried this:

data$subjectID <- factor(rep(1:4, 2*5))
xyplot(responses~time|subjectID*groups, data = data, aspect="xy")

This is what I want but now I don't have the correct subject id's. I
couldn't find a solution in the help of strip.default.

Does anyone has a solution to this?

Thanks in advance, 


> sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: x86_64-unknown-linux-gnu (64-bit)

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods

other attached packages:
[1] lattice_0.19-13

loaded via a namespace (and not attached):
[1] grid_2.12.0  tools_2.12.0

Maarten van Iterson
Center for Human and Clinical Genetics
Leiden University Medical Center (LUMC)
Research Building, Einthovenweg 20 
Room S-04-038
Phone: 071-526 9439
E-mail: M.van_iterson.HG at lumc.nl
Postal address:
Postzone S-04-P
Postbus 9600
2300 RC Leiden 
The Netherlands

More information about the R-help mailing list