Hello I am having trouble with the findCorrelation() function, Here is my input and the output:
findCorrelation(train, cutoff = .50, verbose = FALSE)
Error in findCorrelation_exact(x = x, cutoff = cutoff, verbose = verbose) : correlation matrix is not symmetric
Does anyone know why this is happening?
the findCorrelation function expects a correlation matrix as x value, so try this instead:
findCorrelation(cor(train), cutoff = .50, verbose = FALSE)
Reference: Caret pre-processing
Well, it happens because the matrix possibly does not have as many columns as rows (or vice versa). E.g.
library(caret)
train <- cor(mtcars)
findCorrelation(train, cutoff = .50, verbose = FALSE)
# works
findCorrelation(train[, -1], cutoff = .50, verbose = FALSE)
# Error in findCorrelation_exact(x = x, cutoff = cutoff, verbose = verbose) :
# correlation matrix is not symmetric
dim(train[, -1])
# [1] 11 10
(At least that would be my guess according to the error message.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With