dcode: Convert a factor into a set of dummy codes.

Description Usage Arguments Details Value

View source: R/Data_Mgt_Functions.R

Description

The function converts a factor variable into a set of dummy codes then adds them to the data frame on which it operates.

Usage

1
dcode(x, y, stem)

Arguments

x

A data frame containing the factor varable to be dummy coded.

y

The factor to be recoded.

stem

A character value for the stem of the variable names for the resulting dummy codes.

Details

=============================================================================

Each level of the factor will be turned into a new binary variable in the data frame x with a name of the form stem_level.

Value

An updated data frame containing the new dummy-coded variables.


sjpierce/SSACHR documentation built on Jan. 16, 2022, 12:39 a.m.