Dear John,
If you add observations to the data frame you can do what you want as
indicated by the following code. It may get a bit more complicated
when using groups (panel.superpose). BTW I think 'I(NA)' are required
to prevent x and y from becoming factors.
## Simulate missing combination:
dat <- expand.grid(A=paste("A", 1:3, sep=""), B=paste("B", 1:3, sep=""),
x=1:10, y=0)
dat$y <- rnorm(nrow(dat))
dat <- dat[!(dat$A == "A2" & dat$B == "B3"), ]
## Example of code:
dat <- rbind(dat,
data.frame(A="A2", B="B3", x=I(NA), y=I(NA)))
xyplot(y ~ x | A*B, data = dat,
panel = function(x,y,...) {
if(any(is.na(x))) text(5,0,"Missing Combination")
else panel.xyplot(x,y,...)
})
Regards,
Henrik
--------------------------------------------------------------------------
Henrik Aalborg Nielsen
Informatics and Mathematical Modelling
Section for Statistics, Time Series Group
Technical University of Denmark
Richard Petersens Plads, Build.321,
DK-2800 Kgs. Lyngby, Denmark.
Phone: +45 4525 3418
Fax.: +45 4588 2673
E-mail: han@imm.dtu.dk
URL: http://www.imm.dtu.dk/~han
--------------------------------------------------------------------------
On Tue, 20 May 2003, John Payne wrote:
> Hi all. I am creating trellis plots of the form xyplot(y ~ x | factorA *
> factorB, groups = observed), where observed is a 2-level factor ("observed"
> or "expected"). The problem is that I want to label some, but not all, of
> the panels with the text "No data" (some panels are blank because they
> didn't have enough data to fit a curve, while others are blank because that
> combination of factorA and factorB is missing from the experiment. I want
> to label the latter). Can anyone suggest a straightforward solution? I
> have struggled fruitlessly to figure out the scope of variables within the
> nested and not-so-transparent panel functions.
>
> Thanks!
>
> John Payne
> Department of Zoology
> University of Washington
> Seattle, WA 98195
>
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu. To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message: unsubscribe s-news
>
|