title: Why Pearson correlation output is NaN?
body: <p>I'm trying to get the Pearson correlation coefficient between to variables in R. This is the scatterplot of the variables: </p>
  
  <pre><code>ggplot(results_summary, aes(x =D_in, y = D_ex)) + geom_point(col=ifelse(results_summary$FDR &lt; 0.05, ifelse(results_summary$logF&gt;0, "red", "green" ), "black"))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/p5E5G.png" rel="noreferrer"><img src="https://i.stack.imgur.com/p5E5G.png" alt="enter image description here"></a></p>
  
  <p>As you can see, the variables correlate pretty well, so I'm expecting a high correlation coefficient. However when I try to get the Pearson correlation coefficient I'm getting a NaN!</p>
  
  <pre><code>&gt; cor(results_summary$D_in, results_summary$D_ex, method="spearman")
  [1] 0.868079
  &gt; cor(results_summary$D_in, results_summary$D_ex, method="kendall")
  [1] 0.6973086
  &gt; cor(results_summary$D_in, results_summary$D_ex, method="pearson")
  [1] NaN
  </code></pre>
  
  <p>I checked if my data contains any NaN:</p>
  
  <pre><code>&gt; nrow(subset(results_summary, is.nan(results_summary$D_ex)==TRUE)) 
  [1] 0
  &gt; nrow(subset(results_summary, is.nan(results_summary$D_in)==TRUE)) 
  [1] 0
  &gt; cor(results_summary$D_in, results_summary$D_ex, method="pearson", use="complete.obs")
  [1] NaN
  </code></pre>
  
  <p>But it's seems that is not the reason of the resulting NaN. Can some one give any clue about what is might happening here?</p>
  
  <p>Thanks for your time!</p>