Plotting a 1-by-1 contingency table returns an error:
dat <- read.table(textConnection('
foo bar
TRUE TRUE
TRUE TRUE
'), header = TRUE, colClasses=c('logical', 'logical'))
mosaicplot(table(dat))
Error in rep.int(0, ydim) : invalid 'times' value
As I learned, the code in the mosaicplot function doesn't allow to plot a 1-by-1-table. But then, how do I plot a mosaicplot of that table?
Background.
I am plotting a series of dynamically created tables, some of which sometimes happen to have only one column and one row, at other times they have more dimensions. Having an undivided rectangle in that series of mosaicplots is valuable information and easily grasped in that visual representation.