Suppose the data is given as following:
data=: 0 : 0
area model sales
north T2 3
south T2 4
north T3 10
north T3 5
east T1 1
west T3 1
south T2 11
north T4 2
west T3 1
east T4 1
west T4 6
)
d=: (<a:;<2) ((".&.>)@{)`[`]} }. cut;._2 data
What I want is a report of sales for area by model:
NB. T2 T3 T1 T4
NB. north 3 15 0 2
NB. south 15 0 0 0
NB. east 0 0 1 1
NB. west 0 2 0 6
The final matrix doesn't need to contain row, column-headers -- it is
fine that it contains only the sales total for each area and model
pairs.
I'd like to know easy and simple ways to getting that matrix in J.
What's your suggestion?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm