boxuancui / DataExplorer

Automate Data Exploration and Treatment
http://boxuancui.github.io/DataExplorer/
Other
514 stars 88 forks source link

CollapseCategory does not update when input data is not data.table #30

Closed boxuancui closed 8 years ago

boxuancui commented 8 years ago

To re-produce:

data <- data.frame("a" = as.factor(round(rnorm(500, 10, 5))), "b" = rexp(500, 1:500))
table(data$a)
CollapseCategory(data, "a", 0.2, update = TRUE) ## data is not updated
table(data$a)
boxuancui commented 8 years ago

It is very hard to modify the input data directly, if it is not data.table. Here are a few modifications of this function:

  1. update = TRUE will only work when input data is data.table.
  2. You may still view the frequency distributions with any data format, as long as update = FALSE.