[R] Use different panel functions with lattice

Balaitous balaitous at mailoo.org
Sat Mar 10 17:33:57 CET 2012


Hi,

I have a data.frame df with
names(df) = c("Var1", "Var2", "Var3", "Var4")

and I plot data with

xyplot(Var1+Var2~Var3|Var4, data=df)

I want to use different panel functions for Var1 and Var2.
How can I do ?

Something like :

panel.mypanel = function(x, y, ...) {
  if (Var1) panel.Var1Panel(x, y, ...)
  else panel.Var2Panel(x, y, ...)
}
xyplot(Var1+Var2~Var3|Var4, data=df, panel=panel.mypanel)

(I have search with google, but I found nothing)

Thanks



More information about the R-help mailing list