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
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 >
Hi Try ?panel.number As you have not specified R version I cannot be more specific but for 2.4 there have been changes to lattice including panel.number to panel.number() At 14:10 29/11/06, you 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.Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England ARMIDALE NSW 2351 Email: dmackay9 at pobox.une.edu.au home: mackay at northnet.com.au Phone: 02 6772 9794
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. >