# NOT RUN {
# Given a set with rare "C"
library(data.table)
dataSet <- data.table(cat_col = c(sample(c("A", "B"), 1000, replace=TRUE), "C"))
# When calling function
dataSet <- remove_rare_categorical(dataSet, cols = "cat_col",
threshold = 0.01, verbose = TRUE)
# Then there are no "C"
unique(dataSet[["cat_col"]])
# }
Run the code above in your browser using DataLab