make frequency tables robust to zero values

avoid dividing by row or column totals of zero