to.dummy {REAT}R Documentation

Creating dummy variables

Description

This function creates a dataset of dummy variables based on an input character vector.

Usage

to.dummy(x)

Arguments

x

A character vector

Details

This function transforms a character vector x with c characteristics to a set of c dummy variables whose column names corresponding to these characteristics marked with “_DUMMY”.

Value

A data.frame with dummy variables corresponding to the levels of the input variable.

Note

This function contains code from the authors' package MCI.

Author(s)

Thomas Wieland

References

Greene, W. H. (2012): “Econometric Analysis”. 7th edition. Harlow : Pearson.

Examples

charvec <- c("Peter", "Paul", "Peter", "Mary", "Peter", "Paul")
# Creates a vector with three names (Peter, Paul, Mary)
to.dummy(charvec)
# Returns a data frame with 3 dummy variables
# (Mary_DUMMY, Paul_DUMMY, Peter_DUMMY)

[Package REAT version 3.0.3 Index]