Search code examples
rstatisticscorrelationr-corrplot

Corrplot in R not working


I am trying to work out the correlation between these three labels using 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

But somehow its not showing cross correlation between different labels.

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

enter image description here

Basically it just shows 1,1,1 but no cross correlation and then size comes so smaller. Please suggest.


Solution

  • It seems that you have a mess in your data. I got your data and it all works perfect:

    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