unmap: Dummy matrix for an outcome factor

unmapR Documentation

Dummy matrix for an outcome factor

Description

Converts a class or group vector or factor into a matrix of indicator variables. I got this function from the mixOmics package.

Usage

unmap(classification, groups = NULL, noise = NULL, ...)

Arguments

classification

A numeric or character vector or factor. 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 K matrix of (0,1) indicator variables, where n is the length of samples and K the number of classes in the outcome.

If a noise value of symbol is designated, the corresponding indicator variables are relocated to the last column of the matrix.

Note: - you can remap an unmap vector using the function map from the package mclust.

Author(s)

Rico Derks

References

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, A. E. Raftery, T. B. Murphy and L. Scrucca (2012). mclust Version 4 for R: Normal Mixture Modeling for Model-Based Clustering, Classification, and Density Estimation. Technical Report No. 597, Department of Statistics, University of Washington.


ricoderks/Rcpm documentation built on May 18, 2022, 7:49 a.m.