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
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.