[R] R2.4 xyplot + panel.number problem

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Nov 29 05:35:28 CET 2006


On 11/28/06, Pedro Mardones <mardones.p at gmail.com> wrote:
> Hi all;
> I'm trying to display a 2 panel plot for the Puromycin data from R
> with 2 different non-linear models fitted to each group. The problem
> is that as far as I know panel.number doesn't work in the latest
> version of R.

Yes, sorry about that, but retaining this would have been more work
than I thought was justified. Basically, the functionality provided by
the panel.number argument has been replaced by a more general
panel.number() function (which can be used in more places). From the
help page ?panel.number:

Note:

     The availability of these functions make redundant some features
     available in earlier versions of lattice, namely optional
     arguments called 'panel.number' and 'packet.number' that were made
     available to 'panel' and 'strip'.  If you have written such
     functions, it should be enough to replace instances of
     'panel.number' and 'packet.number' by the corresponding function
     calls.  You should also remove 'panel.number' and 'packet.number'
     from the argument list of your function to avoid a warning.


> Can anyone give a hint how to solve this?
>
> Here is the code that I used before and now doesn't work
>
> xyplot(rate ~conc| state,Puromycin,
> panel=function(x,y,panel.number,...){

It should be enough to replace the last line by these two:

panel=function(x,y,...){
  panel.number <- panel.number()

-Deepayan


> panel.xyplot(x,y,...)
> x.temp<-seq(0, 1.2, len = 101)
> if (panel.number==1) {
> y.temp<-(coef(m2.nls)[1]+coef(m2.nls)[2]) * x.temp/
> (coef(m2.nls)[3] + x.temp)
> panel.lines(x.temp,y.temp,col=2)}
> if (panel.number==2) {
> y.temp<-coef(m2.nls)[1] * x.temp/
> (coef(m2.nls)[3] + x.temp)
> panel.lines(x.temp,y.temp,col=2)}
>  },
> ylab="Rate of reaction",
> xlab="Substrate concentration",
> main = "Puromycin---comparison bt. treated and untreated"
>  )
>
> thanks for any idea
>



More information about the R-help mailing list