Skip to content
Prev 31063 / 398506 Next

sum

The only way I can see is to vectorize your list of matrices. Here's an 
example.

matlist <- lapply(1:10,function(i) matrix(rnorm(12),3,4))
summat <- matrix(sapply(matlist,I)%*%rep(1,10),3,4)

You can use the loop below to verify that the above solution is correct.

forsum <- matrix(0,3,4)
for(i in 1:10)
forsum <- forsum+matlist[[i]]

"summat" and "forsum" should be the same.

HTH,
Jerome
On April 23, 2003 10:57 am, Luis Silva wrote: