mosaicresid - Residual-Shaded Mosaic Plots for 'ggplot2'
A 'ggplot2'-native alternative to the shaded mosaic plots
drawn by mosaicplot() in base 'R'. geom_mosaic_resid() maps two
categorical variables with ordinary 'ggplot2' aesthetics,
recursively partitions the unit square into tiles sized by
their joint proportions, computes Pearson, deviance, or
Freeman-Tukey residuals against a two-way independence model,
and maps the residuals to fill color. It works on raw data,
already aggregated counts, or contingency tables, and the tile
geometry and residuals are also returned as a data frame by
compute_mosaic_residuals().