Creates dummy columns from columns that have categorical variables (character or factor types). You can also specify which columns to make dummies out of, or which columns to ignore. Also creates dummy rows from character, factor, and Date columns. This package provides a significant speed increase from creating dummy variables through model.matrix().
The goal of fastDummies is to quickly create dummy variables (columns) and dummy rows. Creating dummy variables is possible through base R or other packages, but this package is much faster than those methods.
To install this package, use the codeinstall.packages("fastDummies")# install.packages("devtools")devtools::install_github("jacobkap/fastDummies")
There are two functions in this package:
dummy_cols()lets you make dummy variables (
dummy_columns()is a clone of
dummy_rows()which lets you make dummy rows.
Thanks to GitHub user yu45020 dummy_cols() is now about >20% faster and much more memory efficient.
Both dummy_cols() and dummy_rows() now return the same data type inputted
Reduces number of parameter that were in previous version.
Significant speed increases for both dummy_cols() and dummy_rows() functions.
dummy_cols() now accepts numeric columns.