unmap: Converts a class vector to an indicator matrix
Description
Converts a class vector into a matrix of indicator variables, borrowed from the mclust package, used as internal function.Usage
unmap(classification, groups=NULL, noise=NULL, ...)
Arguments
classification
A numeric or character vector. Typically the distinct entries of this
vector would represent a classification of observations in a data set.
groups
A numeric or character vector indicating the groups from which
classification
is drawn. If not supplied, the default
is to assumed to be the unique entries of classification.
noise
A single numeric or character value used to indicate the value of
groups
corresponding to noise.
...
Catches unused arguments in indirect or list calls via do.call
.
Value
- An n by m matrix of (0,1) indicator variables,
where n is the length of
classification
and m is
the number of unique values or symbols in classification
.
Columns are labeled by the unique values in classification
,
and the [i,j]
th entry is 1 if classification[i]
is the jth unique value or symbol in sorted order
classification
.
If a noise
value of symbol is designated, the corresponding indicator
variables are relocated to the last column of the matrix.
encoding
latin1References
C. Fraley and A. E. Raftery (2002).
Model-based clustering, discriminant analysis, and density estimation.
Journal of the American Statistical Association 97:611-631.
C. Fraley and A. E. Raftery (2006).
MCLUST Version 3 for R: Normal Mixture Modeling and Model-Based Clustering,
Technical Report no. 504, Department of Statistics,
University of Washington.