Library: | graphic |
See also: | transform |
Quantlet: | groupcol | |
Description: | Decomposes a (color) vector into single groups. |
Usage: | {g, gind} = groupcol (col, ncol) | |
Input: | ||
col | scalar or color vector | |
ncol | scalar, expected length of colorvector | |
Output: | ||
gcol | m x 1, different colors | |
gind | n x 1, index of groups |
; loads the library graphic library("graphic") ; generate a color vector, e.g. for swiss banknote col = matrix(5)|(4*matrix(5)) ; computes the different colors {gcol, gind} = groupcol(col, 10) ; show the different colors gcol ; show the index vector(5 ones and 5 twos) gind
decomposition of the color vector: Contents of gcol [1,] 1 [2,] 4 Contents of gind [ 1,] 1 [ 2,] 1 [ 3,] 1 [ 4,] 1 [ 5,] 1 [ 6,] 2 [ 7,] 2 [ 8,] 2 [ 9,] 2 [10,] 2