Skip to content
Prev 180851 / 398506 Next

how to calculate means of matrix elements

Easy enough.  What if some of the matrix elements contained missing values? 
Then how could you still calculate the means?  Example code below:
mat1 <- matrix(c(1,2,3,4,5,NA,7,8,9),3,3)
mat2 <- matrix(c(NA,6,1,9,0,5,8,2,7),3,3)
mat3 <- matrix(c(5,9,1,8,NA,3,7,2,4),3,3)
Gabor Grothendieck wrote: