I thought this was a good candidate for the plyr package, but it seems that l*ply functions are meant to operate only on separate list elements:
> Lists are the simplest type of input to deal with because they are > already naturally > divided into pieces: the elements of the list. For this reason, the > l*ply functions dont > need an argument that describes how to break up the data structure. > (from: plyr: divide and conquer, Hadley Wickham 2008) Perhaps a new case to consider? Best wishes, baptiste On 30 Dec 2008, at 15:33, Stephan Kolassa wrote: > Dear useRs, > > I have a list, each entry of which is a matrix of constant dimensions. > Is there a good way (i.e., not using a for loop) to apply a mean to > each > matrix entry *across list entries*? > > Example: > > foo <- list(rbind(c(1,2,3),c(4,5,6)),rbind(c(7,8,9),c(10,11,12))) > some.sort.of.apply(foo,FUN=mean) > > I'm looking for a componentwise mean across the two entries of foo, > i.e., the following output: > > [,1] [,2] [,3] > [1,] 4 5 6 > [2 _____________________________ Baptiste Auguié School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag ______________________________ [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org 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.