groups

Syntax

groups(X)

Arguments

X is a vector.

Details

For each unique value in X, return the indices of all elements that hold the value.

Examples

x=NULL NULL 12 15 12 16 15 14 NULL NULL
groups(x);

// output
16->[5]
->[0,1,8,9]
12->[2,4]
14->[7]
15->[3,6]