[R] densityplot and panel.groups

Ken Beath kbeath at efs.mq.edu.au
Fri Jul 7 02:15:20 CEST 2006


I am trying to plot multiple densityplots on each panel, and using  
panel.groups to do some additional plotting (not included in the  
example) as in this example.

library(lattice)

thedata <- data.frame(x=rnorm(1200),class=rep(1:3,each=200,times=2),
	group=rep(1:2,each=100,times=6))

densityplot(~x | class,groups=group,
	xlab='x',
	panel.groups = function(x,subscripts,groups,panel.number,...) {
		panel.densityplot(x=x,subscripts=subscripts,groups=groups,...)
# other stuff here
	},
	plot.points=FALSE,
	layout=c(3,1),
	data=thedata)

But get an "Error in panel.superpose(x, darg = darg, plot.points =  
plot.points, ref = FALSE,  : formal argument "panel.groups" matched  
by multiple actual arguments" using R 2.3.1 (MacOS X 10.4.7), I think  
this worked with a previous version of R.



More information about the R-help mailing list