title: How to replace Inf and NaN with NA in an xts object
body: <p>I have an <code>xts</code> object (<code>df</code>):</p>
  
  <pre><code>##                  a     b
  ## 2015-09-14 -0.5470    NA
  ## 2015-09-15  0.0112    NA
  ## 2015-09-16  0.0910 0.932
  ## 2015-09-17    -Inf 0.862
  ## 2015-09-18     Inf 1.946
  ## 2015-09-21 -0.7050 2.692
  ## 2015-09-22     NaN 2.011
  ## 2015-09-23 -0.5440 1.859
  ##     .
  ##     .
  ##    etc
  </code></pre>
  
  <p>Because column <code>a</code> includes <code>Inf</code>, <code>-Inf</code> and <code>NaN</code>, I am getting some errors. Is there a way to replace these values with <code>NA</code> (to treat <code>Inf</code> and <code>NaN</code> as missing values)?</p>