【问题标题】:Corrplot in R not working [closed]R中的Corrplot不起作用[关闭]
【发布时间】:2017-12-05 11:23:11
【问题描述】:

我正在尝试使用corrplot 来计算这三个标签之间的相关性:

train.Item_ID   train.Price   train.Number_Of_Sales
30495           165.123          1
30375           68.666           5
30011           253.314          2
30864           223.122          1
30780           28.75            1

但不知何故,它没有显示不同标签之间的交叉相关性。

corrplot(cor(newtrain),method = "number")

基本上它只显示 1,1,1 但没有互相关,然后尺寸变得如此之小。请提出建议。

【问题讨论】:

  • 这是你所有的数据吗?如果是,我无法重现。如果不能,您可以将dput(cor(newtrain)) 的结果添加到您的问题中。
  • 当我查看您的图表时,我确实看到了与这些相同大小的互相关。它们只是非常苍白,因为所有相关性都接近于零。尝试将bg="lightgray" 添加到您的 corrplot 命令中。
  • @GSW 是的,它现在可以正常工作了..感谢您指出:)
  • @user20650.. GSW 所说的问题是由于相关性较小,现在我明白了这个问题,而不仅仅是数据样本,实际数据要大得多。

标签: r statistics correlation r-corrplot


【解决方案1】:

您的数据似乎一团糟。我得到了你的数据,一切都很完美:

library(corrplot)

d <- "train.Item_ID   train.Price   train.Number_Of_Sales
1 30495           165.123          1
2 30375           68.666           5
3 30011           253.314          2
4 30864           223.122          1
5 30780           28.75            1"

d <- read.table(text = d, header = T)

corrplot(cor(d), method = "number")

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2013-01-23
  • 2022-01-01
  • 2020-06-25
  • 1970-01-01
  • 1970-01-01
  • 2015-03-11
  • 2017-05-31
  • 1970-01-01
相关资源
最近更新 更多