On Wed, 26 Sep 2007, Riccardo (Jack) Lucchetti wrote:
On Wed, 26 Sep 2007, andreas.rosenblad(a)ltv.se wrote:
> What I am asking for is following output
> ? xtab C
> [ 1][ 2] TOT.
> [ 1] 3 2 5
> [ 2] 2 3 5
> TOTAL 5 5 10
Let's separate the issues: in theory, you can get the numbers easily by
D = ( C ~ sumr(C) ) | ( sumc(C) ~ sumc(sumr(C)) )
but this seems not to work at present; it's a bug...
This relates to something we discussed here a while ago, namely
the ambiguity surrounding '|': logical OR, or row-wise matrix
You get the correct result if you force the issue by providing a
definite matrix context:
matrix D = (C ~ sumr(C)) | (sumc(C) ~ sumc(sumr(C)))
However, maybe it is time to retire '|' as OR, and to insist on
'||' for that meaning.