Thanks so much, Hadley. That's exactly what I needed. My only comment is that the line
cast(Subj + List + Condition ~ variable , mean) should be cast(dfm, Subj + List + Condition ~ variable , mean) Your excellent demo on your site cleared that up quickly, however. Thanks again, Pedro On 12/17/06, hadley wickham <[EMAIL PROTECTED]> wrote: > On 12/16/06, Pedro Alcocer <[EMAIL PROTECTED]> wrote: > > Hello, > > > > My ultimate goal is a repeated measures (mixed model) ANOVA, however, > > my present question is about how to reorganize my data into the format > > that the ANOVA commands expect. In particular, how to collapse across > > trials. (I am using the tutorial at > > [http://personality-project.org/r/r.anova.html] for the mixed model > > ANOVA) > > > > The data I am using looks like this. A subject sees 10 trials per > > condition and there are 2 conditions. I want the average of all the > > reaction times (RTs) from a subject looking a one condition. I also > > want to retain List in the final output. > > Have a look at the reshape package, http://had.co.nz/reshape. > > The following code should do what you want: > > install.packages("reshape") > library(reshape) > dfm <- melt(df, id=c("Subj", "List","Condition")) > cast(Subj + List + Condition ~ variable , mean) > > (that should work with any number of rt variables) > > Hadley > ______________________________________________ R-help@stat.math.ethz.ch 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.