[R] length of 'dimnames'  not equal to array extent- For Correlation Plot
sarah.goslee at gmail.com
Sat Mar 17 16:15:46 CET 2018
I'm assuming you are using the corrplot package.
If so, your data object does need to be a matrix, not a data frame.
Since it's already a data frame, your line of code:
doesn't need the as.data.frame function, but more importantly, you
didn't assign the result to anything: as.matrix() does not work in
CR1 <- as.matrix(CR1)
If that doesn't work, then provide a reproducible example so we can
offer further advice.
On Sat, Mar 17, 2018 at 11:08 AM, Shivi Bhatia <shivipmp82 at gmail.com> wrote:
> Created a new data set with 3 numeric variable to find correlation
> CR1<- mar%>% as_data_frame%>% select(AGE, OLD_CAR_PURCHASE_YRS,
> had to convert it to a data frame, code:
> Now i need to run a correlation plot for these 3 variables:
> corrplot(CR1, method = "circle")
> But i am getting this error:
> Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow =
> nr, : length of 'dimnames'  not equal to array extent
> Researched and found Correlation
> corrplot requires a matrix however the error is still the same.
> Regards, Shivi
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help