Change a factor variable to dummy variable

I want to make multinomial logit model. I have changed my variables to factors in R. However, I have to change some of these categorical variables to dummy ones. I tried different codes. Particularly, I tried dummyVar. However, It does not give me a variable for modeling. I appreciate it if you give me the code for that.

There is this discussion


But also note that with factor variables with R in a regression, your regression results will automatically convert factor levels into dummies when reporting your coefficient estimates. I feel this has a good discussion

https://stats.idre.ucla.edu/r/modules/coding-for-categorical-variables-in-regression-models/

1 Like