group {lca} | R Documentation |
Function to identify which items in a vector, or rows in a table, are identical. Returns a vector of numeric labels.
group(x)
x |
either a vector or table to be identified. |
The function takes a table and determines which rows are the same, and assigns all such rows a unique integer label. The integers used are 1,2,...,k where k is the number of unique rows.
If a vector is supplied instead of a matrix or table, then the elements of the vector are evaluated in the same manner.
A numeric vector (whose length corresponds to the number of items in x
)
containing the labels.
Robin Evans
x = matrix(c(1,1,1,2,2,1,1,2,2,1,2,2),6,2) x group(x) # rows 2, 3, and 6 are identical.