Unique
Unique(a, i)
Returns a maximal subset of index «i» such that each indicated slice of array «a» along «i» is unique.
Unique can be used to remove duplicate slices from an array, or to identify a single member of each equivalence class.
Example
Let:
DataSet →
Field ▶ | |||
---|---|---|---|
PersonNum ▼ | LastName | FirstName | Company |
1 | Smith | Bob | Acme |
2 | Jones | John | Acme |
3 | Johnson | Bob | Floorworks |
4 | Smith | Bob | Acme |
Then:
Unique(DataSet, PersonNum) → [1, 2, 3]
Unique(DataSet[Field = 'Company'], PersonNum) → [1, 3]
Optional parameters
Position
By default, Unique returns the elements of the index. Setting the optional parameter «position» equal true (position: true
) will return the positions of the elements in «i» , rather than the elements themselves (see Associative vs. Positional Indexing).
CaseInsensitive
When applying Unique to text values, values are considered by default in a case-sensitive fashion, for example, "Apple" and "apple" are considered distinct elements.
Specifying caseInsensitive: true ignores differences in upper and lower case in text values when determining if values are unique.
Enable comment auto-refresher