Cluster analysis in two-way contingency tables