title: Calculating Covariance and correlation of a target variable with all columns in dataframe
body: <p>I have tried fixing the weird bug I am getting time and again while calculating covariance and correlation of all variables(one by one) of a data frame with the target variable , but I get the following error :-</p>
  
  <pre><code>&gt; for(i in 1:290)
  + {
  +     ins_comb&lt;-subset(InsTrainNumer,!(is.na(InsTrainNumer[,i])))
  +     print(nrow(ins_comb))
  +     variable&lt;-as.matrix(ins_comb[,i])
  +     target&lt;-as.matrix(ins_comb$target)
  +     ins_cor[i]&lt;-cor(variable,target = NULL,use="everything")
  +     ins_cov[i]&lt;-cov(variable,target = NULL,use="everything")
  +     print(ins_cor[i])
  +     print(ins_cov[i])
  + } [1] 452061  Show Traceback
  </code></pre>
  
  <p>Rerun with Debug</p>
  
  <pre><code> Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
    'data' must be of a vector type, was 'NULL'
  </code></pre>
  
  <p>Where lies the catch ?</p>