B05999
B05999

Reputation: 53

Q function that computes the value

How would I write a function in q/kdb that computes the value in a vector.

Upvotes: 1

Views: 101

Answers (1)

MurrMack
MurrMack

Reputation: 579

q)l:1 1 1 2 2 2 3 4 1 2 7 6 4
q)where max[a]=a:count each group l
1 2
q)min where max[a]=a:count each group l
1
q)mode:{where max[a]=a:count each group x}
q)min mode l
1
q)mode l
1 2

As you can see above I would just define a mode function and then use min before the function call to return an atom of the lowest value.

Upvotes: 4

Related Questions