dummy {vannstats} | R Documentation |
Creating Dummy-Code Columns for Values of a Variable
Description
This function applies dummy-coding to a variable of interest, enabling the creation of n or n-1 columns/variables based on n number of attributes for the variable.
Usage
dummy(df, var, remove = FALSE)
Arguments
df |
data frame to read in. |
var |
the variable to be dummy-coded. Is automatically converted to a character string. |
remove |
logical (default set to |
Value
This function updates the data frame with new variables (columns) representing unique values of a selected variable, and a binary score (0/1) for the absence or presence of a column's represented value for each observation.
Examples
data <- howell_aids_long
dummy(data, student)
[Package vannstats version 1.3.4.14 Index]