4

我正在尝试使用. Hmisc但是为什么summary()要从变量 OCCUPATION 中删除一个类别(“其他”)?

library(Hmisc)
summary(ID ~ OCCUPATION, data=df, method="reverse")

输出:ID 的描述性统计

+--------------------------+--------+--------+
|                          |HUSBAND |SELF    |
|                          |(N=28)  |(N=72)  |
+--------------------------+--------+--------+
|OCCUPATION : SELF EMPLOYED|93% (26)|31% (22)|
+--------------------------+--------+--------+

将此与简单的比较table()

        OCCUPATION
ID        OTHERS SELF EMPLOYED
  HUSBAND      2            26
  SELF        50            22
4

1 回答 1

4

这是为了任何遇到这个特殊问题的人的利益。在浏览了非常非常长的文档后,我偶然发现了解决方案Hmisc。解决方案是使用print()withexclude1=F选项:

print(summary(ID ~ OCCUPATION, data=df, method="reverse"), exclude1=F)



Descriptive Statistics by ID

+-------------------+--------+--------+
|                   |HUSBAND |SELF    |
|                   |(N=28)  |(N=72)  |
+-------------------+--------+--------+
|OCCUPATION : OTHERS| 7% ( 2)|69% (50)|
+-------------------+--------+--------+
|    SELF EMPLOYED  |93% (26)|31% (22)|
+-------------------+--------+--------+
于 2013-05-21T04:27:46.410 回答