panel function question
On 3/27/08, Weidong Gu <wgu at uab.edu> wrote:
I have two data sets with locations, X, Y of houses (df.house) and
habitats(df.habitat), respectively. In each dataset, there are 3
replicates (Repeat). Because each replicate has different locations of
houses and habitats, I would like to plot them in panels. I wrote
something like this:
mypanel<-function(x,y,subscripts,...){
panel.xyplot(x,y,pch=20)
panel.xyplot( df.habitat$X[subscripts], df.habitat$Y[subscripts], pch=3)
}
with(df.house, xyplot(X~Y|Repeat, panel=mypanel, subscripts=T))
But the problem is that all habitats from 3 replicates are ended in one
panel.
Any help would be appreciated.
A reproducible example would have helped; I don't think I understand what exactly you want to produce. As a general rule though, it's usually easier to do things if you have a single data frame, which in this case might be produced by combined <- make.groups(df.house, df.habitat) This will have a new variable called 'which' indicating the source, and you could use this variable in your call. -Deepayan