2017-07-01 50 views
0

我試圖找出這三個標籤之間的相關性使用corplotCorrplot R中不工作

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") 

enter image description here

基本上它只是表明1,1,1,但沒有互相關,然後尺寸來得小。請建議

+0

是你所有的數據 - 如果是這樣,我不能重現。如果不是,你可以把'dput(cor(newtrain))'的結果添加到你的問題中。 – user20650

+2

當我看着你的圖,我_DO_看到與那些相同大小的互相關。他們只是非常蒼白,因爲所有的相關性都接近於零。嘗試在您的corrplot命令中添加'bg =「lightgray」'。 – G5W

+0

@GSW是的,它現在正常工作..感謝您指出:) –

回答

0

看來,你在你的數據一團糟之前標準化您的數據。我收到了你的數據,這一切完美的作品:

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") 

enter image description here

+0

這是一個顏色代碼問題,我已經發現了......但無論如何感謝:)也有反正改變那個情節的大小? –

+0

您將需要打印打印設備,並更改寬度和高度,請參閱此處的示例https://stackoverflow.com/questions/14753344/corrplot-parameters-in-r –

0

也許你應該申請「心病」

newtrain <- scale(newtrain) 
+0

縮放不會改變相關性 – user20650

+0

但它的無害...嘗試這個選項與corrplot: 'col = c(「black」,「white」),bg =「淺藍色」' – Prem

+0

有反正有改變大小情節? –