calculate frequency table, not just unique values