[R] plot(all.effects)

Michael Kubovy kubovy at virginia.edu
Tue Oct 24 16:39:15 CEST 2006


Dear r-helpers,

plot(all.effects()) uses trellis for its output, and often produces  
several effect plots in a layout. Can anyone tell me how to set the  
arguments to plot.effect which default to
row=1, col=1, nrow=1, ncol=1, more=FALSE
so that I can plot multiple effect plots on one layout?

I was hoping that a call like

last <- rep(c(TRUE, FALSE), c(3, 1))
lay <-matrix(c(1:4,), 2, 2, byrow = T)
for(i in 1:4) {
	tmp.lm <- lm(y ~ a + b, data)
	spl <- which(lay == i, arr.ind = TRUE)
	rowN = spl[1]
	colN = spl[2]
	plot(all.effects(tmp.lm), row = rowN, col = colN, nrow = 2, ncol =  
2, more = last[i])
}

would work (my data are complicated, and have not had the time to set  
up a replicable example).

Here is what I ran, and what R told me:
for(i in 1:4) {
	tmp.lm <- lm(duration ~ (pitch + vis + aud + display)^2 -  
aud:display - vis:aud -
		pitch:vis, data = subset(txt, subj == unique(txt$subj)[i]))
	spl <- which(lay == i, arr.ind = TRUE)
	rowN = spl[1]
	colN = spl[2]
	plot(all.effects(tmp.lm), rug = F, ask = F,
		main = paste('Subject = ',sep = '', i),
		row = rown, col = coln, nrow = 2, ncol = 2, more = last[i])
  }
Error in plot.effect(x[[(i - 1) * cols + j]], row = i, col = j, nrow  
= rows,  :
	formal argument "row" matched by multiple actual arguments

_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/



More information about the R-help mailing list