This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Compare the performance of two purportedly-fast ways of generating dummy variables from character vector. | |
| # NOTE: fastDummies retains the original variable by default while modeldb does not | |
| # Dependencies | |
| library(microbenchmark) | |
| library(fastDummies) | |
| library(modeldb) | |
| library(dplyr) | |
| # Simulate data: 1 million rows, 1 variable with 26 unique values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(dplyr) | |
| # Wrap data simulation in a function | |
| sim_data <- function(N) { | |
| ########################################################################### | |
| # parameters | |
| ########################################################################### | |
| set.seed(123) |
OlderNewer