My data looks like
## data = ## A B C a b c ## 0 1 0 1 1 0 ## 0 0 1 1 0 0 ## 1 1 0 0 1 0 ## 0 0 1 0 0 1 ## 0 1 0 1 1 0 ## 1 0 0 0 1 0
How to compare data for such results:
## A B C ## a 0.7 -0.2 -0.2 ## b 0.3 -0.5 1.0 ## c -0.7 0.4 -1.0
I am inspired by this article and I want to create a similar heat map. But more than that:
It is executed cor(data), and then crop the matrix of the necessary submatrix - the right approach? Or should I run another function, not cor(data)?
cor(data)
Since the desired sub-matrix is not a block from the diagonal of the entire matrix, I do not think there is a better shortcut, and you should use
cor(M)[c("a", "b", "c"), c("A", "B", "C")] # A B C # a -0.7071068 0.3333333 0.0000000 # b 0.5000000 0.7071068 -1.0000000 # c -0.3162278 -0.4472136 0.6324555
or just cor(M)[4:6, 1:3].
cor(M)[4:6, 1:3]
Source: https://habr.com/ru/post/1693798/More articles:React Native: Hex Scrolling with DrawerNavigator - react-nativeWhy is BiConsumer allowed to assign using a function that accepts only one parameter? - lambdaWhy doesn't git-revert cause pre-commit and commit-msg locks? - gitWhat area does C ++ live in? - c ++(AD) in PowerShell - powershellIs it possible to use 64-bit and 32-bit commands in the same executable file on 64-bit Linux? - assemblyHow a 64-bit linux kernel starts a 32-bit process from ELF - linuxПравильный подход к отображению успеха, сообщения об ошибках через NGRX - javascriptThe usefulness of volatiles in parallel programming with C ++ 11 - c ++Как передать массив в функцию vararg Int с помощью оператора Spread? - arraysAll Articles