title: R - I want to go through rows of a big matrix and remove all zeros
body: <p>I have a lot of rows and columns in a very large matrix (184 x 4000, type double), and I want to remove all 0's. The values in the matrix are usually greater than 0 but there are some rows of 0.0000 . I tried to remove the rows with zeros using this: </p>
  
  <pre><code>x &lt;- x[which(rowSums(x) &gt; 0),]
  </code></pre>
  
  <p>but what I am left with is a mere 3 rows out of 184. And I know for a fact that the deleted 181 rows were not all 0 rows. 
  Does anyone have a clue why this is happening and how I can fix it? I used this same code on a different matrix with the same structure (184 rows, 4000 columns) and it worked. What am I missing?</p>