Hi there,
I am new to R and have what seems to be a simple question. I put together
the following commands in order to run an anova on multiple different
variables at once:

for(i in 10:20)
{subj <- mydata[ which(lupi2$subject=='mas'),]
cat("****************ANOVA for variable:", names(subj[i]))
print(summary(aov(subj[,i]~config*blockType*hemi+Error((freqs*rep)/(config*blockType*hemi)),
data=subj)))}

so I have config, blockType, hemi as within subject factors and the random
effects are freqs and reps.

Ideally however I would much rather be able to group the aov output by the
variable subject in my original "mydata" rather then have to run this loop
several times, and recreate variable subj over and over again (for each
subject...). I tried using by() as follows:

by(lupi2, subject,
summary(aov(mydata[,10]~config*blockType*hemi+Error(freqs*rep/(config*blockType*hemi)),
data=mydata)))

but I think I am doing something wrong in the way I am defining the function
in that case (here simplified without the loop).

Any insight on how to group aov by a variable value (or factor) would be
much appreciated,
thanks!

Ayelet Landau
UC Berkeley

	[[alternative HTML version deleted]]


