title: Remove the columns with the colsums=0
body: <p>I have a matrix which its elements are 0, 1,2,NA!<br>
  I want to remove the columns which their colsums are equal to 0 or NA! I want to drop these columns from the original matrix and create a new matrix for these columns (nonzero colsums)!
   (I think for calculating colsums I have consider na.rm=True and remove the colums with colsum=0,  because if I consider na.rm=False all the values of my colsums get NA)</p>
  
  <p>this is my matrix format:</p>
  
  <pre><code>mat[1:6,1:6]
  
  1:11059017  1:11088817  1:11090640   1:11099385   1:1109967  1:111144756
  
   0        0            0             0           NA          0
   0        0            0             0           0          NA
   1       NA            2             0           NA          0    
   0        0            0             1          0           2  
   2        0            0             0          0           0
   0        0            NA            0          0           0
  
   Summat &lt;-  colSums(mat,na.rm = TRUE)
  
  head(summat)
  
  1:11059017  1:11088817  1:11090640   1:11099385   1:1109967  1:111144756 
  
  [,1]   3           0             2          1           0            2
  </code></pre>
  
  <p>The 2nd and 5th columns have colsum=0 so I Ishould remove them from the met and keep the rest of columns in  another matrix.</p>
  
  <p>my output should be like below:</p>
  
  <pre><code>met-nonzero
  
   1:11059017      1:11090640     1:11099385     1:111144756
  
    0             0                  0                0
    0             0                  0                NA
    1             2                  0                0
    0             0                  1                2  
    2             0                  0                0
    0             NA                 0                0
  </code></pre>
  
  <p>would you please let me know how can I do that? </p>
  
  <p>data:</p>
  
  <pre><code>structure(c(0L, 0L, 1L, 0L, 2L, 0L, 0L, 0L, NA, 0L, 0L, 0L, 0L, 
  0L, 2L, 0L, 0L, NA, 0L, 0L, 0L, 1L, 0L, 0L, NA, 0L, NA, 0L, 0L, 
  0L, 0L, NA, 0L, 2L, 0L, 0L), .Dim = c(6L, 6L), .Dimnames = list(
      NULL, c("X1.11059017", "X1.11088817", "X1.11090640", "X1.11099385", 
      "X1.1109967", "X1.111144756")))
  </code></pre>
  
  <p>Thanks</p>