On Tue, Jul 6, 2010 at 2:47 AM, Coen van Hasselt <coenvanhass...@gmail.com> wrote: > Hello, > > I would like to know how I can filter out empty plots in xyplot, when > stratifying on some variables. > > Example: > > I have a dataset in which I plot CONC ~ TIME, stratified for patient > ID(1,2,..,100), FORM(1,2) and BOOST (1,2). > Some patients (ID's) do not have values for all stratification > conditions. I.e. one patient may have values for FORM=1 and BOOST=1,2, > while others may have data on alle combinations. > > xyplot(CONC ~ TIME | ID + FORM + BOOST, dat=data) > > If I do this I also get empty plots for all the combinations for which > I do not have data for. Is it possible for xyplot NOT to make plots > for combinations of ID, FORM and BOOST that do not contain data ?
Lattice will only drop levels of conditioning variables that are completely empty. For what you want, you need to create an interaction; something like xyplot(CONC ~ TIME | ID:FORM:BOOST, dat=data) -Deepayan ______________________________________________ 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.