Skip to content
Prev 176187 / 398503 Next

number of zeros in a matrix -row by row

Dear Dimitris,

Thanks very much. I tried dim(M) and get:
[1] 5030 2142

which I thought meant that my matrix M is actually a matrix, but
I tried  str(M) and get:

 int [1:5030, 1:2142] 2 1 2 0 1 0 2 1 2 -1 ...

When I tried 
rowSums(M == 0)

I got:
Error in rowSums[M == 0] : 
  object of type 'closure' is not subsettable


What am I doing wrong?

Thanks so much.
Dimitris Rizopoulos-4 wrote: