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 the
This worked for me, slightly change of @Richard Scriven:
remove_zeros<- function(x) { x = x[!apply(x == 0, 1, all),] return(x) }