How about this?
# your data
(M1 <- matrix( 1:4, nrow=2, ncol=2))
(M2 <- matrix( 5:8, nrow=2, ncol=2))
(L <- list(M1, M2))
# setting up a matrix for the results
M.res<-M1
# filling the matrix
for (i in 1:length(M.res)) {
M.res[i]<-mean(sapply(as.vector(L), "[", i)) # apply some function, in
this example the mean
}
M.res # look at the results
STG
--
Stefan Th. Gries
-----------------------------------------------
University of California, Santa Barbara
http://www.linguistics.ucsb.edu/faculty/stgries
-----------------------------------------------
_______________________________________________
R-lang mailing list
[email protected]
https://ling.ucsd.edu/mailman/listinfo.cgi/r-lang