Does the {Hmisc} summary category fall?

I am trying to get a crosstab with percentages from this file using Hmisc . But why does summary() drop the category ("OTHER") from the OCCUPATION variable?

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

Conclusion: Descriptive Statistics by ID

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

Compare this to simple table()

  OCCUPATION ID OTHERS SELF EMPLOYED HUSBAND 2 26 SELF 50 22 
+4
source share
1 answer

This is for the benefit of the one who is faced with this strange problem. I came across a solution after moving on to the very long documentation that Hmisc has. The solution is to use print() with the exclude1=F option:

 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)| +-------------------+--------+--------+ 
+4
source

Source: https://habr.com/ru/post/1481318/


All Articles