I would use files with arrays, so if you have listfor example:
n <- 5
someList <- lapply(1:n, function(i) matrix(1:4+(i-1)*4,2,2))
convert it to 3d array
someArray <- array(unlist(someList ), c(2,2,n))
Now you can use rowSums
rowSums(someArray, dims=2)
Marek source
share