title: R cor.test : "not enough finite observations"
body: <p>I'm currently trying to create an R function computing the corr.test correlation of a specified column with all the numeric columns of a dataframe. Here's my code :</p>
  
  <pre><code>#function returning only numeric columns
  only_num &lt;- function(dataframe)
  {
    nums &lt;- sapply(dataframe, is.numeric)
    dataframe[ , nums]
  }
  
  #function returning a one-variable function computing the cor.test correlation of the variable
  #with the specified column
  
  function_generator &lt;- function(column)
    {
      function(x)
      {
        cor.test(x, column, na.action = na.omit)
      } 
    }
  
  data_analysis &lt;- function(dataframe, column)
    {
    DF &lt;- only_num(dataframe)
  
    fonction_corr &lt;- function_generator(column)
  
    sapply(DF, fonction_corr)
  
    }
  
  data_analysis(40, 6, m, DF$Morphine)
  </code></pre>
  
  <p>When I call "data_analysis" at the last line, I get the following error :</p>
  
  <p>"Error in cor.test.default(x, column, na.action=na.omit) :
  not enough finite observations"</p>
  
  <p>What could it mean? What should I change? I'm kind of stuck...</p>
  
  <p>Thanks.</p>
  
  <p>Clément</p>