unmap: Dummy matrix for an outcome factor

Description Usage Arguments Value References Examples

View source: R/unmap.R

Description

Converts a class or group vector or factor into a matrix of indicator variables.

Usage

1
  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.

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. - this function should be used to unmap an outcome vector as in the non-supervised methods of mixOmics. For other supervised analyses such as (s)PLS-DA, (s)gccaDA this function is used internally.

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.

Examples

1
2
3
4
5
6
data(nutrimouse)
Y = unmap(nutrimouse$diet)
Y
data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid, Y = Y)
# data could then used as an input in wrapper.rgcca, which is not, technically, 
# a supervised method, see ??wrapper.rgcca

Example output

Loading required package: MASS
Loading required package: lattice
Loading required package: ggplot2

Loaded mixOmics 6.3.2

Thank you for using mixOmics!

How to apply our methods: http://www.mixOmics.org for some examples.
Questions or comments: email us at mixomics[at]math.univ-toulouse.fr  
Any bugs? https://bitbucket.org/klecao/package-mixomics/issues
Cite us:  citation('mixOmics')
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
      [,1] [,2] [,3] [,4] [,5]
 [1,]    0    0    1    0    0
 [2,]    0    0    0    0    1
 [3,]    0    0    0    0    1
 [4,]    0    1    0    0    0
 [5,]    0    0    0    1    0
 [6,]    1    0    0    0    0
 [7,]    0    0    1    0    0
 [8,]    0    0    1    0    0
 [9,]    0    1    0    0    0
[10,]    1    0    0    0    0
[11,]    0    1    0    0    0
[12,]    0    0    0    1    0
[13,]    0    0    0    0    1
[14,]    0    0    0    1    0
[15,]    0    0    0    0    1
[16,]    0    0    1    0    0
[17,]    1    0    0    0    0
[18,]    0    1    0    0    0
[19,]    1    0    0    0    0
[20,]    0    0    0    1    0
[21,]    1    0    0    0    0
[22,]    0    0    0    1    0
[23,]    0    0    0    0    1
[24,]    0    1    0    0    0
[25,]    0    0    0    0    1
[26,]    0    0    0    1    0
[27,]    0    0    0    1    0
[28,]    0    0    1    0    0
[29,]    0    1    0    0    0
[30,]    0    0    1    0    0
[31,]    1    0    0    0    0
[32,]    1    0    0    0    0
[33,]    0    0    0    1    0
[34,]    0    0    0    0    1
[35,]    0    1    0    0    0
[36,]    1    0    0    0    0
[37,]    0    0    1    0    0
[38,]    0    1    0    0    0
[39,]    0    0    1    0    0
[40,]    0    0    0    0    1
attr(,"levels")
[1] "coc"  "fish" "lin"  "ref"  "sun" 

mixOmics documentation built on June 1, 2018, 5:06 p.m.

Related to unmap in mixOmics...