[R] accessing column and row numbers inside splom in lattice

Roger Levy rlevy at ling.ucsd.edu
Sun Jan 31 04:20:11 CET 2010


Hi,

When using splom() in the lattice package, I would like to be able to  
access the row and column number of each individual pairs plot ,  
similar to the way that current.row() and current.column() can be used  
in other lattice plotting functions such as xyplot.  For example, I  
would like to be able to write something along the lines of

library(mvtnorm)
library(lattice)
y <- rmvnorm(100,c(0,0,0),diag(3))
splom(y,panel=function(x,y,...){
	# I would like to access the panel row i and column j here, e.g.,
	# print(i,j)
	panel.splom(x,y,...)
	})

but I haven't been able to find a way to do this; current.row() and  
current.column() only vary at the level of splom's superpanel function.

Does anyone have a suggestion on how to access this information?  I  
have looked into tweaking panel.pairs() to pass the i,j row,column  
information into the splom panel function, but it is not trivial  
because panel.pairs() calls several lattice-internal functions which  
are not exported.  So if there is a better way, I would be grateful to  
know!

Many thanks,

Roger
--

Roger Levy                      Email: rlevy at ling.ucsd.edu
Assistant Professor             Phone: 858-534-7219
Department of Linguistics       Fax:   858-534-4789
UC San Diego                    Web:   http://ling.ucsd.edu/~rlevy



More information about the R-help mailing list