Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Define correlated variable in correlation matrix #90
Comments
vsimko
added the
question
label
Mar 10, 2017
|
I'm not sure how this relates to |
|
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)) |
vsimko
self-assigned this
Mar 10, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Navien2 commentedMar 10, 2017
•
edited by vsimko
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: