I am having some difficulty using the cor function using compounded
column data from a table.
If someone could please explain where I am going wrong on this
simplified example it would be much appreciated.
// Example Data
q)x:(stock
close)!(aaa
bbb`ccc;(1 2 3 4;5 6 7 8;9 10 11 12))
q)y:flip x
q)y
stock close
aaa 1 2 3 4
bbb 5 6 7 8
ccc 9 10 11 12
q)y[close][0] cor y[
close][0]
1f
q)a:exec i from y where stock=aaa q)a ,0 q)y[
close][a]
1 2 3 4
q)y[close][a] cor y[
close][a]
k){avg x*x-:avg x}
'length
Perfuming the operation by selecting the data also returns a length
error,
q)a:exec close from y where stock=`aaa
q)a cor a
k){avg x*x-:avg x}
'length
Thanks