I would like to average the same cells in multiple lists of matrices and the result be a matrix with averaged cells. e.g.
x <- list()
x[[1]] <- data.frame(matrix(sample(1:7,16, replace = T),4,4))
x[[2]] <- data.frame(matrix(sample(1:7,16, replace = T),4,4))
> x[[2]]
X1 X2 X3 X4
1 3 5 2 6
2 4 2 5 1
3 7 7 3 3
4 7 4 7 1
> x[[1]]
X1 X2 X3 X4
1 6 5 2 7
2 7 2 7 7
3 3 5 7 1
4 5 4 1 7
I would like a 4x4 matrix with each entry the average of the same entry of the two lists.
Thanks