title: Remove infinite values from a matrix in R
body: <p>I have a matrix <code>m</code> in R , and I would like to remove <code>-Inf</code> values , and then calculate the <code>colMeans</code> of all columns. How can I do this in R?</p>
  
  <pre><code>m &lt;- matrix(c(1, 3, 4, -Inf, 6, 7, 4, -Inf, 6, 0, 1, 3) , nrow = 3)
  m
         [,1] [,2] [,3] [,4]
  [1,]     1  -Inf    4    0
  [2,]     3   6    -Inf   1
  [3,]     4   7      6    3
  </code></pre>