[R] Lattice: reasons for not passing subscripted "col", "pch", "lty", "fill" to panel functions

From: Vitalie Spinu <vitosmail_at_rambler.ru>
Date: Thu, 03 Jul 2008 12:45:49 +0200

Dear UseRs!

I am really amazed by lattice capabilities but one thing is really beyond my understanding.
I would like to have conditional plots with points inside each panel colored by groups "gr1" and "pched" by "gr2":

xyplot(A~B|C,myD,col=gr1,pch=gr2) #this makes sense for me

But this does not work, because "col","pch","lty","fill" etc. are passed directly to panel function and not subscripted by conditional variable C. The result is that the same truncated vectors col,pch,lty are used for all panels.

I know I can write something like this to overcome the problem:

xyplot(A~B|C,myD,col=gr1,pch=gr2,

        panel=function(x,y,...,subscripts,col,pch){
		 panel.xyplot(x,y,col=col[subscripts],pch=pch[subscripts]
	)

)
but is so clumsy :(.

Isn't it possible to have panel.XUZ(x,y,...,col=col[subscritps],...) or something like that? And dispense whith "groups" variable whatsoever?

Sorry if I missed something.

Many thanks,
Vitalie.



R-help_at_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. Received on Thu 03 Jul 2008 - 10:51:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jul 2008 - 17:31:46 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive