[R] Count number of zeros in a collumn

Marcio Resende mresendeufv at yahoo.com.br
Sun Sep 27 22:54:10 CEST 2009


I have a matrix 700x2000 which is sampled in each cycle from another matrix
788x2000 with the numbers 0,1 and 9

There is one specific collumn of this matrix, dart[,1977], that usually,
after the samplimg procedure has only 1 and 9 (because the zero frequency in
this collumn is low).
However, when this happens, I want to include an IF conditional in my code.
so basically what i wanted to do was to count the number of zeros in this
collumn to use this information in my conditional:

something like:

if (the number of zeros in collumn [,1977] is zero) ... else ...

I tried to find out indirectly by the rowsum but because of the sampling
procedure the rowsum is not always the same

Thank you very much
-- 
View this message in context: http://www.nabble.com/Count-number-of-zeros-in-a-collumn-tp25637516p25637516.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list