Closed Navien2 closed 7 years ago
I'm not sure how this relates to corrplot
?
Moreover, such a large matrix will render very slowly in corrplot.
Would this help ?
# generating some random data 1302x8
some_random_data <- rnorm(1302)
Adata2 <- data.frame(
a = rnorm(1302),
b = some_random_data,
c = rnorm(1302),
d = some_random_data,
e = rnorm(1302),
f = rnorm(1302),
g = -some_random_data,
h = rnorm(1302))
A <- as.matrix(Adata2)
res <- cor(t(A))
# reorder variables
library(corrplot)
ord <- corrMatOrder(res, order = "FPC")
res <- res[ord, ord]
# plot the matrix including legend
library(raster)
plot(raster(res))
I have used the code bellow to detect correlation between the variable in my matrix which is 1302x8 and i transpose the matrix and the r result is 1302x1302, then I pick the upper triangle of the corr matrix then I'am trying to flatten it to see the correlated variable, but the code has issue:
The error is: