eigen(corr) 中的错误:制作“相关矩阵圆图”时“x”中存在无限值或缺失值

use*_*802 8 r matrix heatmap correlation

我想制作一个如下所示的相关矩阵。然而,R一直告诉我

'Error in eigen(corr) : infinite or missing values in 'x''
Run Code Online (Sandbox Code Playgroud)

相关矩阵圆

我认为这可能是由我的矩阵中的 NA 值引起的。但是,当我尝试通过添加来删除它们时

'na.rm=TRUE,' it doesnt seem to help

circle.corr( cor(Plant, na.rm=TRUE,), order = TRUE, bg = "gray50", 
    col = colorRampPalette(c("blue","white","red"))(100) )
Run Code Online (Sandbox Code Playgroud)

我已经加载了上面链接中提供的功能

是否可以创建一个新的 data.frame 并删除 NA?如果是这样,怎么办?

ags*_*udy 5

没有数据很难帮助您,但是会出现错误,因为您的相关矩阵包含NA并且eigen无法计算这种情况下的特征值。

这应该有效:

circle.corr( cor(Plant,use = "complete.obs"),   # NA are removed
      order = TRUE, bg = "gray50",
      col = colorRampPalette(c("blue","white","red"))(100) )
Run Code Online (Sandbox Code Playgroud)