Creates a matrix of dummy responses from a factor. Needed in some multivariate analyses.
Usage
dummy(f, simplify = TRUE)
Arguments
f
vector (internally transformed into factor).
simplify
logical indicating if the last column of the response matrix should be removed (to avoid model overfitting).
Author(s)
Maxime Herv<c3><a9> <mx.herve@gmail.com>
Examples
fac <- gl(3,5,labels=LETTERS[1:3])
dummy(fac)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(RVAideMemoire)
*** Package RVAideMemoire v 0.9-56 ***
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RVAideMemoire/dummy.Rd_%03d_medium.png", width=480, height=480)
> ### Name: dummy
> ### Title: Dummy responses
> ### Aliases: dummy
>
> ### ** Examples
>
> fac <- gl(3,5,labels=LETTERS[1:3])
> dummy(fac)
A B
1 1 0
2 1 0
3 1 0
4 1 0
5 1 0
6 0 1
7 0 1
8 0 1
9 0 1
10 0 1
11 0 0
12 0 0
13 0 0
14 0 0
15 0 0
>
>
>
>
>
> dev.off()
null device
1
>