group {lca}R Documentation

Identify Identical Rows in Table or Matrix

Description

Function to identify which items in a vector, or rows in a table, are identical. Returns a vector of numeric labels.

Usage

group(x)

Arguments

x either a vector or table to be identified.

Details

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.

Value

A numeric vector (whose length corresponds to the number of items in x) containing the labels.

Author(s)

Robin Evans

See Also

unique collapse.cases

Examples

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.

[Package lca version 0.2 Index]