dummy: Create Dummy Variables

Description Usage Arguments Value Author(s) Examples

View source: R/dummy.R

Description

Creates dummy variables.

Usage

1
2
  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.

Author(s)

Scott S. Emerson, M.D., Ph.D., Andrew J. Spieker, Brian D. Williamson

Examples

1
2
3
4
5
  # 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)

uwIntroStats documentation built on Oct. 10, 2018, 5:04 p.m.