partconv: Numeric Encoding of a Partitioning

Description Usage Arguments Value See Also Examples

View source: R/util.R

Description

Converts a vector interpreted as a classification or partitioning into a numeric vector.

Usage

1
partconv(x, consec=TRUE)

Arguments

x

A vector interpreted as a classification or partitioning.

consec

Logical value indicating whether or not to consecutive class numbers should be used .

Value

Numeric encoding of x. When consec = TRUE, the distinct values in x are numbered by the order in which they appear. When consec = FALSE, each distinct value in x is numbered by the index corresponding to its first appearance in x.

See Also

partuniq

Examples

1
2
3
4
5
6
partconv(iris[,5])

set.seed(0)
cl <- sample(LETTERS[1:9], 25, replace=TRUE)
partconv(cl, consec=FALSE)
partconv(cl, consec=TRUE)

mclust documentation built on Nov. 22, 2017, 5:05 p.m.