Generate a frequency table of a factor grouped into top-n, bottom-n, and all other levels.
Useful links