The input vectors to table are interpreted as row indexes and column
indexes, respectively. Without weights, we add 1, otherwise the
corresponding weight value to the output cells.
So in your example you have constant row indexes of 1 but a seq(1,10)
for column indexes and hence you get a 1x10 output matrix.
Regards,
Matthias
On 4/21/2017 4:00 AM, arijit chakraborty wrote:
> Hi,
>
>
> I was trying to understand what the "table" function does. In the documents, it says:
>
>
> "Returns the contingency table of two vectors A and B. The resulting table F consists
of max(A) rows and max(B) columns."
>
>
> Suppose I've 2 matrix A and B of this form:
>
>
> A = matrix(1, 1, 10)
> B = matrix(seq(10,1, 1), 10, 1)
>
>
> I should have a matrix of form
>
> C = matrix(1, 10, 1).
>
>
> But I'm getting
>
> C = matrix(1, 1, 10).
>
>
> Also, what is the difference between "Group form" and "Scalar form"?
>
>
> Thank you!
>
> Arijit
>
