This is a bit of a difficult question to title, so edits welcome. The data looks like this:
mat =
[,1]
[1,] 9.586352e-04
[2,] NA
[3,] 2.605841e-03
[4,] 7.868957e-05
[5,] 1.000000e+00
[6,] NA
[7,] 8.208500e-02
[8,] 2.605841e-03
[9,] 7.868957e-05
[10,] 1.000000e+00
[11,] 9.586352e-04
[12,] 8.208500e-02
[13,] 2.605841e-03
[14,] 7.868957e-05
[15,] 1.000000e+00
I want to sum every 5 elements, so since there are 15, I the length of the returned vector should be 3. (15/3). So for example, just count the NA's as 0.
How do I do this?
I also want to ignore the NA's