powered by

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

partuniq(x)

A vector of length nrow(x) with integer entries. An observation

nrow(x)

k is assigned an integer i whenever observation i

k

i

is the first row of x that is identical to observation k

x

(note that i <= k).

i <= k

Matrix of observations.

partconv

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)

Run the code above in your browser using DataLab