cor shows only NA or 1 for correlations - Why?

后端 未结 6 1246
别那么骄傲
别那么骄傲 2020-12-08 07:03

I\'m running cor() on a data.framewith all numeric values and I\'m getting this as the result:

       price exprice...
price      1         


        
6条回答
  •  心在旅途
    2020-12-08 07:08

    very simple and correct answer

    Tell the correlation to ignore the NAs with use argument, e.g.:

    cor(data$price, data$exprice, use = "complete.obs")
    

提交回复
热议问题