【发布时间】:2017-10-30 19:43:31
【问题描述】:
我有一个包含 4 个变量的数据框 - cur、price、volume 和 carat。
除了 cut 之外,一切都是数值变量: 我能够得到价格、数量和克拉的相关矩阵。 这是下面的代码,
Jewels_Input_Data_2 <- subset(Jewels_Input_Data,select = c(price,Volume,carat))
#Correlation Plot to examine the relationships between price, volume, caret
library(corrplot)
CorMatrix <- cor(Jewels_Input_Data_2)
上图显示了所有有序切割水平的相关矩阵。我想为每个级别的剪辑显示它。
换句话说,我想通过分类变量来打破 CorMatrix - Cut 具有有序的级别。
说每个切割级别 - 我想查看矩阵值,理想情况下我想使用 corrplot() 绘制它
请帮帮我。
【问题讨论】:
-
以
CorList <- lapply(split(Jewels_Input_Data_2, Jewels_Input_Data$cut), cor)开始,然后绘制列表中的每个元素CorList。
标签: r