partuniq: Classifies Data According to Unique Observations

Description Usage Arguments Value See Also Examples

View source: R/util.R

Description

Gives a one-to-one mapping from unique observations to rows of a data matrix.

Usage

1

Arguments

x

Matrix of observations.

Value

A vector of length nrow(x) with integer entries. An observation k is assigned an integer i whenever observation i is the first row of x that is identical to observation k (note that i <= k).

See Also

partconv

Examples

1
2
3
4
5
6
7
8
9
set.seed(0)

mat <- data.frame(lets = sample(LETTERS[1:2],9,TRUE), nums = sample(1:2,9,TRUE))
mat

ans <- partuniq(mat)
ans

partconv(ans,consec=TRUE)

Example output

Package 'mclust' version 5.4.3
Type 'citation("mclust")' for citing this R package in publications.
  lets nums
1    B    2
2    A    1
3    A    1
4    B    1
5    B    2
6    A    1
7    B    2
8    B    1
9    B    2
[1] 1 2 2 4 1 2 1 4 1
[1] 1 2 2 3 1 2 1 3 1

mclust documentation built on Nov. 5, 2021, 5:07 p.m.