Difference between revisions of "Unique"

Line 43: Line 43:
 
Then  
 
Then  
 
  Unique(DataSet, PersonNum) → [1, 2, 3]
 
  Unique(DataSet, PersonNum) → [1, 2, 3]
  code>Unique(DataSet[Field='Company'], PersonNum) → [1, 3]
+
  code>Unique(DataSet[Field = 'Company'], PersonNum) → [1, 3]
  
 
== Optional parameters ==
 
== Optional parameters ==

Revision as of 06:57, 7 December 2015


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.

Examples

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]
code>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.

See also

Comments


You are not allowed to post comments.