title: How to calculate maximum and minimum in R disregarding the infinite values?
body: <p>My data has the format of the example below (on a smaller scale here):</p>
  
  <pre><code>a &lt;- c(NaN, Inf, 1, 2, 3, 4, 5)
  </code></pre>
  
  <p>I know that if I use in R:</p>
  
  <pre><code>min(a, na.rm = TRUE)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>max(a, na.rm = TRUE)
  </code></pre>
  
  <p>the <code>NaN</code> will be disregarded but not the <code>Inf</code>, so that in <code>min(a, na.rm = TRUE)</code> the result is <code>1</code> (disregarding the <code>NaN</code> because of <code>na.rm = TRUE</code>), but the result in <code>max(a, na.rm = TRUE)</code> is <code>Inf</code>.</p>
  
  <p>Is there any way to get, in R, the maximum and minimum of a vector and also disregard the infinite <code>Inf</code>, as well as the<code>NaN</code> is disregarded?</p>
  
  <p>I appreciate any help.</p>