Re: [R] panel function question

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Fri, 28 Mar 2008 14:06:40 -0700

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



R-help_at_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. Received on Fri 28 Mar 2008 - 21:17:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 28 Mar 2008 - 21:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive