title: R: NaNs produced
body: <p>I have a time series in R Studio. Now I want to calculate the log() of this series. I tried the following: </p>
  
  <pre><code>i &lt;- (x-y) 
  ii &lt;- log(i)
  </code></pre>
  
  <p>But then I get the following: <code>Warning message: In log(i): NaNs produced</code>
  To inspect this I used: <code>table(is.nan(ii))</code> which gives me the following output:</p>
  
  <pre><code>FALSE  TRUE 
   2480     1 
  </code></pre>
  
  <p>So I assume, that there is 1 NaN in my time series now. My question is: what code can I use, that R shows me for which observation a NaN was produced?
  Here is a small data sample: <code>i &lt;- c(9,8,4,5,7,1,6,-1,8,4)</code>
  Btw how do I type mathematical formulas in stackoverflow, for example for log(x)? Many thanks</p>