mad: Make binary dummy variables out of a factor vector

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/mad.R

Description

Make binary dummy variables out of a factor vector

Usage

1
mad(x, red = TRUE)

Arguments

x

A factor vector. Or a vector that is convertible to a factor.

red

Logical. Shall redundancy be retained? When a factor variable is broken down to binary dummy variables it is typically not wanted to transfer all levels to 0/1 vectors but to skip the last level because the information is already contained in the sum of the other variables.

Value

Returns a data.frame with binary data (0/1) with as many (n) rows as x has levels (with red=TRUE) or with n-1 levels when red=FALSE.

Author(s)

Gerald Jurasinski, gerald.jurasinski@uni-rostock.de

References

Legendre & Legendre 1998. Numerical ecology. Elsevier

See Also

sim, mps

Examples

1
2
3
4
5
6
## load bernina data
data(bernina)
## have a look at summit$year
summits$year
## make binary dummies from that
mad(summits$year)

simba documentation built on May 1, 2019, 8:49 p.m.