uwIntroStats (version 0.0.7)

dummy: Create Dummy Variables

Description

Creates dummy variables.

Usage

dummy(x,subset=rep(T,length(x)),
        reference=sort(unique(x[!is.na(x)])),includeAll=F, version=F)

Arguments

x

variable used to create the dummy variables.

subset

a subset of the data, if desired.

reference

the reference value for the dummy variables to compare to.

includeAll

logical value indicating whether all of the dummy variables should be returned (including the reference).

version

if TRUE, returns the version of the function and nothing else.

Value

A matrix containing the dummy variables.

Examples

Run this code
# NOT RUN {
  # Reading in a dataset
  mri <- read.table("http://www.emersonstatistics.com/datasets/mri.txt", header=TRUE)
  attach(mri)
  # Create a dummy variable for race
  dummy(race)
# }

Run the code above in your browser using DataLab