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

Gabor Grothendieck ggrothendieck at gmail.com
Wed Nov 29 10:20:27 CET 2006


As requested on last line of every message to r-help please
provide self contained reproducible code.  Also please
space it properly since its very difficult to read in your post.

I have used the models defined in example(Puromycin)
in place of your undefined ones and made some changes
to keep the example short and easier to read:

example(Puromycin)  # defines fm1 and fm2
xyplot(rate ~ conc | state, Puromycin,
   panel = function(x, y, ...) {
     panel.xyplot(x, y, ...)
     fm <- list(fm1, fm2)[[ panel.number() ]]
     panel.lines(conc, predict(fm, list(conc = conc)))
   }
)

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. 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,...){
> 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
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list