nunique

Syntax

nunique(X)

Arguments

X is a vector or a tuple composed of multiple vectors with same length.

Details

If X is a vector, return the number of unique elements in X.

If X is a tuple, elements of each vector at the same position forms a key, and this function returns the number of unique keys.

Examples

$ v = [1,3,1,-6,NULL,2,NULL,1];
$ nunique(v);
5
$ t=table(1 2 4 8 4 2 7 1 as id, 10 20 40 80 40 20 70 10 as val);
$ select nunique([id,val]) from t;

nunique

5