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. |
library("stats") x=(1:4|3)~matrix(5)~(2|2|3|3|3) {xr,r}=tableN(x) xr~r
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