RでSAS風の表集計
CrossTable{gmodels}を使う。行や列で見たときのパーセンテージが出せる。
パッと人に見せる時には良いと思う。
> CrossTable(infert$education, infert$induced, digits=1, expected=F, prop.r=T, prop.c=F, prop.t=F, prop.chisq=F, format="SPSS") Cell Contents |-------------------------| | Count | | Row Percent | |-------------------------| Total Observations in Table: 248 | infert$induced infert$education | 0 | 1 | 2 | Row Total | -----------------|-----------|-----------|-----------|-----------| 0-5yrs | 4 | 2 | 6 | 12 | | 33.3% | 16.7% | 50.0% | 4.8% | -----------------|-----------|-----------|-----------|-----------| 6-11yrs | 78 | 27 | 15 | 120 | | 65.0% | 22.5% | 12.5% | 48.4% | -----------------|-----------|-----------|-----------|-----------| 12+ yrs | 61 | 39 | 16 | 116 | | 52.6% | 33.6% | 13.8% | 46.8% | -----------------|-----------|-----------|-----------|-----------| Column Total | 143 | 68 | 37 | 248 | -----------------|-----------|-----------|-----------|-----------|