groups

Syntax

groups(X)

Arguments

X is a vector.

Details

Return a dictionary. The keys of the dictionary are the unique values of the elements of X; the values of the dictionary are the vector subscripts of positions that take the value of the corresponding key.

Examples

$ x=NULL NULL 2 5 2 6 5 4 NULL NULL
$ groups(x);

->[0,1,8,9]
2->[2,4]
4->[7]
5->[3,6]
6->[5]