Learn R Programming

dummies (version 1.03)

which.dummy: Identify which columns are dummy variables on a data frame.

Description

Given a data frame and an optional variable name, which.dummy identifies which colummns are dummy variables by the column index.

Usage

which.dummy(data, name=NULL)

Arguments

data
An object with a 'dummies' attribute
name
Optional. The name of a column that has been expanded to a dummy variable.

Value

  • integer vector of column indices corresponding to the dummy variable(s)

Details

Given a data frame and an optional variable name, returns the indices of the dummy columns.

Requires an dummies attribute, usually created by dummy.data.frame.

See Also

dummy.data.frame, dummy

Examples

Run this code
data(iris)
  dat <- dummy.data.frame(iris)
  which.dummies(dat)

Run the code above in your browser using DataLab