Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: stats
See also: discrete table2

Quantlet: tableN
Description: tableN returns a N way table for N-dimensional data.

Usage: {xr,r} = tableN(x)
Input:
x n x N matrix, the columns correspond to the variables.
Output:
xr m x N matrix, includes all possible combinations of values, sorted by last column.
r m x 1 vector, contains the number of replications of each combination. Some values may be 0. The sum of r is equal the count of observations.

Example:
library("stats")
x=(1:4|3)~matrix(5)~(2|2|3|3|3)
{xr,r}=tableN(x)
xr~r

Result:
Contents of _tmp
[1,]        1        1        2        1
[2,]        2        1        2        1
[3,]        3        1        2        0
[4,]        4        1        2        0
[5,]        1        1        3        0
[6,]        2        1        3        0
[7,]        3        1        3        2
[8,]        4        1        3        1



Author: S. Schmelzer, M. Mueller, 19990218
(C) MD*TECH Method and Data Technologies, 05.02.2006