Given a variable x with n distinct values, create n new dummy coded variables coded 0/1 for presence (1) or absence (0) of each variable. A typical application would be to create dummy coded college majors from a vector of college majors.
A vector to be transformed into dummy codes
When coding demographic information, it is typical to create one variable with multiple categorical values (e.g., ethnicity, college major, occupation).
dummy.code will convert these categories into n distinct dummy coded variables.
If using dummy coded variables as predictors, remember to use n-1 variables.
A matrix of dummy coded variables
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.