library(vcd)

View the data

structable(~gender + right + left, data=VisualAcuity)
##             right    1    2    3    4
## gender left                          
## male   1           821  116   72   43
##        2           112  494  151   34
##        3            85  145  583  106
##        4            35   27   87  331
## female 1          1520  234  117   36
##        2           266 1512  362   82
##        3           124  432 1772  179
##        4            66   78  205  492

Select and process women

women <- subset(VisualAcuity, gender=="female", select=-gender)
structable(~right + left, data=women)
##       left    1    2    3    4
## right                         
## 1          1520  266  124   66
## 2           234 1512  432   78
## 3           117  362 1772  205
## 4            36   82  179  492
sieve(Freq ~ right + left,  data = women, 
      gp=shading_Friendly, labeling=labeling_values,
      main="Vision data: Women")

Select and process men

men <- subset(VisualAcuity, gender=="male", select=-gender)
structable(~right + left, data=men)
##       left   1   2   3   4
## right                     
## 1          821 112  85  35
## 2          116 494 145  27
## 3           72 151 583  87
## 4           43  34 106 331
sieve(Freq ~ right + left,  data = men, 
      gp=shading_Friendly, labeling=labeling_values,
      main="Vision data: Men")

plot both together

cotabplot(Freq ~ right + left | gender, data=VisualAcuity, panel=cotab_sieve, gp=shading_Friendly)