rvisualizationggcorrplot

Create Correlogram Using Harman23 Data Set


One of my questions for an assignment is asking me to create a Correlogram using the cov variable from the Harman23 data set, which is included in the ggplot2 package. Though I keep getting errors for not supplying x and y but the only examples given to me by my professor show him writing ggcorrplot(cor(data), type="lower", lab=TRUE) for example.

Here are some of the commands I've tried so far.

> Harman23 = Harman23.cor
> ggcorrplot(cor(Harman23), type="lower", lab=TRUE)
Error in cor(Harman23) : supply both 'x' and 'y' or a matrix-like 'x'
> ggcorrplot(cor(Harman23, x=Harman23$cov), type="lower", lab=TRUE)
Error in cor(Harman23, x = Harman23$cov) : 'y' must be numeric

Solution

  • > cov = Harman23.cor$cov
    >ggcorrplot(cor(cov),type="lower", lab=TRUE)