title: Remove NA/NaN/Inf in a matrix
body: <p>I want to try two things : </p>
  
  <ol>
  <li>How do I remove rows that contain NA/NaN/Inf </li>
  <li>How do I set value of data point from NA/NaN/Inf to 0.</li>
  </ol>
  
  <p>So far, I have tried using the following for NA values, but been getting warnings.</p>
  
  <pre><code>&gt; eg &lt;- data[rowSums(is.na(data)) == 0,]
  </code></pre>
  
  <blockquote>
  <pre><code> Error in rowSums(is.na(data)) : 
         'x' must be an array of at least two dimensions
       In addition: Warning message:
       In is.na(data) : is.na() applied to non-(list or vector) of type 'closure'
  </code></pre>
  </blockquote>