Combining low frequency counts

后端 未结 7 749
没有蜡笔的小新
没有蜡笔的小新 2020-12-03 19:24

Trying to collapse a nominal categorical vector by combining low frequency counts into an \'Other\' category:

The data (column of a dataframe) looks like this, and c

7条回答
  •  忘掉有多难
    2020-12-03 20:16

    A little late to the game, but you may use my package DataExplorer. The group_category function is exactly what you are looking for. There are other options too, you can type ?group_category to find out more.

    For example, in your case:

    library(DataExplorer)
    group_category(data, "colname", 0.02, update = TRUE)
    

    Here are more examples.

提交回复
热议问题