Re: [R] xyplot: Combining 'subscripts' and 'allow.multiple=T' On 4/20/07, Sundar Dorai-Raj  wrote:>>> SÃ¸ren HÃ¸jsgaard said the following on 4/20/2007 3:57 AM:> > Dear all, Consider this plot> >> > xyplot(Sepal.Length + Sepal.Width ~ Petal.Length | Species,> >        data = iris, allow.multiple=T,  outer=F,> >        panel = function(x,y,...) {> >             panel.xyplot(x,y,...)> >        }> > )> >> > I want to *add* some things to each panel and what I want to add involves using the data for each panel, so I try to take this subset of data out with subscripts:> >> > xyplot(Sepal.Length + Sepal.Width ~ Petal.Length | Species,> >        data = iris, allow.multiple=T, outer=F,> >        panel = function(x,y,subscripts,...) {> >             panel.xyplot(x,y,...)> >             subiris <- iris[subscripts,] # Something using this ...> >        }> > )> >> > and then I get> > Error in NextMethod("[") : argument "subscripts" is missing, with no default Interesting. I get Error in panel.superpose(x, y, type = type, groups = groups, pch = pch,  :        argument "subscripts" is missing, with no default which is somewhat more informative. > > Does anyone know how to obtain this??> >> > By the way: The doc on xyplot says:  "The value of subscripts becomes slightly more complicated when allow.multiple is in effect. Details can be found in the source code of the function latticeParseFormula.". Sure.> > Maybe a better thing to say would be:     "The documented value of 'subscripts' does not hold when     using an extended formula (with terms separated by '+')." which while entirely useless, is completely accurate and at leastwouldn't give you anything to complain about. Would you prefer that? In any case, you can always do something like panel = function(x, y, subscripts, ...) {    print(subscripts) ## debug}, R is a programming language after all, and if you are not prepared touse it as such, may be you shouldn't be writing complicated panelfunctions. -Deepayan > > Best regards> > SÃ¸ren> >> >       [[alternative HTML version deleted]]> >> >> >> > ------------------------------------------------------------------------> >> > ______________________________________________> > R-help@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.>>> Hi, SÃ¸ren,>> Since you add "subscripts" to your panel arguments, you now need to> explicitly pass it on to panel.xyplot. Try:>>   xyplot(Sepal.Length + Sepal.Width ~ Petal.Length | Species,>         data = iris, allow.multiple=T, outer=F,>         panel = function(x,y,subscripts,...) {>              panel.xyplot(x,y,subscripts=subscripts,...)>              subiris <- iris[subscripts,] # Something using this ...> })>> HTH,>> --sundar>> ______________________________________________> R-help@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.> ______________________________________________R-help@stat.math.ethz.ch mailing listhttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.