Hi R users,
I have a matrix "m" of the type:
m
? ? ? X4.20.2010 X4.19.2010 ? X4.16.2010
[1,] ?0.008319468 0.00000000 -0.008250825
[2,] ?0.005574136 0.01816118 ?0.073081608
[3,] -0.047830688 0.01612903 -0.030239833
[4,] ? ? ? ? ? NA ? ? ? ? NA ? ? ? ? ? NA
[5,] ?0.008746356 0.02848576 -0.025566107
[6,] -0.007990868 0.00000000 -0.026666667
I want to get the sum of each column. Normally I would do:
apply(m,2,sum)
but I get:
X4.20.2010 X4.19.2010 X4.16.2010
? ? ? ?NA ? ? ? ? NA ? ? ? ? NA
This is because of the presence of "NA" in m. How do you the equivalent of