Hi,
Can anyone please help me export the following correlation matrix as a csv. Using save returns a type error, I assume because it is not a table, nor dictionary. Thanks in advance!!
Hi,
Can anyone please help me export the following correlation matrix as a csv. Using save returns a type error, I assume because it is not a table, nor dictionary. Thanks in advance!!
Hi Tyler,
Your matrix is not a table, it’s a dictionary where the keys are a list of symbols. To be a keyed table, the keys would have to be a table.
You could convert the keys to be table with the code below.
The output for both objects appears to be the same for both, but if you use .Q.s1, you will see the difference.
Regards,
Paul
q)a
bc!(
ab
c!1 2 3;a
bc!4 5 6;
ab
c!7 8 9)
| a b c
-| -----
a| 1 2 3
b| 4 5 6
c| 7 8 9
q).Q.s1 a
bc!(
ab
c!1 2 3;a
bc!4 5 6;
ab
c!7 8 9)
“a
bc!+
ab
c!(1 4 7;2 5 8;3 6 9)”
q)
q){(flip enlist[]!enlist key x)!value x}
ab
c!(a
bc!1 2 3;
ab
c!4 5 6;a
bc!7 8 9)<br> | a b c<br>-| -----<br>a| 1 2 3<br>b| 4 5 6<br>c| 7 8 9<br>q).Q.s1 {(flip enlist[
]!enlist key x)!value x} a
bc!(
ab
c!1 2 3;a
bc!4 5 6;
ab
c!7 8 9)
“(+(,)!,
ab
c)!+a
b`c!(1 4 7;2 5 8;3 6 9)”
Hi Paul,
Thank you very much, that piece of code worked, I also had to run the code in parts first corr:flip corr and then d:corr cor/::corr and afterwards I used your code and was able to export it as a csv.
Once again thank you very much!!