R - corrplot correlation matrix division
Asked Answered
E

1

1

Here I make an example 12x12 correlation matrix:

df <- data.frame(x1=rnorm(20),x2=rnorm(20),x3=rnorm(20),x4=rnorm(20),x5=rnorm(20),x6=rnorm(20),x7=rnorm(20),x8=rnorm(20),x9=rnorm(20),x10=rnorm(20),x11=rnorm(20),x12=rnorm(20))
cormatx <- cor(df)
corrplot(cormatx, method="color")

I was wondering how this one output could be divided in to four separate 6x6 matrixes? Here is an image of how the output should be divided. I hope this makes sense. enter image description here

Eastward answered 12/5, 2015 at 11:3 Comment(4)
Do you just want the lines added?Farm
Nope. I want the script to vomit out four separate 6x6 matrixes instead of one larger 12x12 matrix.Eastward
Have you looked at image?Farm
No, I haven't. I think I need to divide cormatx to those bits. The image is just there to simplify the needed output.Eastward
S
2

Like this?

par(mfrow = c(2,2))
corrplot(cormatx[1:6,1:6], method="color")  
corrplot(cormatx[1:6,7:12], method="color")  
corrplot(cormatx[7:12,1:6], method="color")  
corrplot(cormatx[7:12,7:12], method="color")  
Siobhan answered 12/5, 2015 at 12:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.