Thank you for the quick answers. Now I remember that there was a related discussion on the list a while ago. I understand the issues related to NAs in matrices, and actually it is not a big problem at all as there are ways to circumvent this easily.
> How are NAs (NaNs) getting into your matrix? Why do you think they ought
to be ignored/skipped instead of propagating when doing calculations on
the matrix?
I simply that I run a loop filling some columns of a zero matrix, but the length of the resulting column vectors vary. Hence, some entries remain zero, but before computing meanc(), I would like to discard the zero entries.
However, Jack's solution is just doing its job. Thank you, Jack!