未获取预期的相关性值-R cor()
在使用R的未获取预期的相关性值-R cor(),r,correlation,pearson,R,Correlation,Pearson,在使用R的cor()查找相关性时,我得到了除对角线项以外的所有NA值。我两两删除了NAs。当我明确删除NAs时,我得到了期望的结果。我是否误解了这些论点 我试过了 > c <- Result_table[,.SD,.SDcols=c("organic_account_countsession", "organic_account_countsession")] > b <- cor(c, use="pairwise.complete.obs")
cor()
查找相关性时,我得到了除对角线项以外的所有NA值。我两两删除了NAs。当我明确删除NAs时,我得到了期望的结果。我是否误解了这些论点
我试过了
> c <- Result_table[,.SD,.SDcols=c("organic_account_countsession", "organic_account_countsession")]
> b <- cor(c, use="pairwise.complete.obs")
organic_account_countsession organic_account_countsession
organic_account_countsession 1 NA
organic_account_countsession NA 1
这完全是我的错误 我已经导入了
h2o
包以及stats
包。
原来在h2o
中有一个cor()
函数,并且具有不同的行为
cor <- stats::cor
cor
c <- c[complete.cases(c)]
b <- cor(c)
organic_account_countsession organic_account_countsession
organic_account_countsession 1 1
organic_account_countsession 1 1
cor <- stats::cor