On Thu, Sep 24, 2009 at 2:14 PM, Martin Lepage <martin.d.lep...@gmail.com> wrote: >> The problem I am facing is that I do not know how to generically access >> the conditioning variables within the panel function. In this simple >> case, I can achieve what I want to do with the following call : >> >> do_something_with(Type[which.packet()]) >> > > I just continued testing and I realized that the last line I wrote only > worked on my test session because I had a object named 'Type' > that existed in the workplace : > > Type <- dataset.Type > > I cannot access the xyplot 'data$Type' object from within the panel > function (although dataset$Type obviously works). > > I will continue my search through the documentation and report any > success.
The way to pass extra variables to panel functions is to add arguments to the high-level call, e.g., xyplot( y ~ x | Type, dataset, type.var = dataset$Type, type.levels = levels(dataset$Type) panel = function(..., type.var, type.levels) { panel.xyplot(...) do_something_with(type.levels[which.packet()]) }) The fact that the extra variable here is a conditioning variable is a coincidence. There is no special mechanism to access conditioning variables inside the panel function. -Deepayan ______________________________________________ R-help@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.