刚刚看到HMISC摘要(),它看起来像是一个快速工具,用于为我的手稿准备描述性统计数据的shell表。
我有这段代码:
summary.stats<-summary(lead_ind ~ age + gender + Region, npct="both", method="reverse",data=DfStudy, test=TRUE)
> str(DfStudy$gender)
Factor w/ 2 levels "Female","Male": 2 1 2 1 2 2 1 2 2 1 ...
> str(DfStudy$lead_ind)
Factor w/ 2 levels "<5","> 5": NA 1 1 1 1 NA 1 1 2 2 ...
> str(DfStudy$Region)
Factor w/ 11 levels "ASIA (EX. NEAR EAST) ",..: 1 1 1 1 1 1 1 1 1 1 ...
但是,我的结果表只有一个性别级别。
---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| |N |<5 |> 5 | Test |
| | |(N=1147) |(N=145) |Statistic |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
|age |1705| 4.445/ 8.530/12.910| 3.310/ 6.550/10.760| F=13.15 d.f.=1,1290 P<0.001 |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
|gender : Male |1705| 49% (565) | 66% ( 95) |Chi-square=13.62 d.f.=1 P<0.001|
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
|Region : ASIA (EX. NEAR EAST) |1705| 37% (422) | 67% ( 97) |Chi-square=49.91 d.f.=4 P<0.001|
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| BALTICS | | 0% ( 0) | 0% ( 0) | |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| C.W. OF IND. STATES | | 0% ( 2) | 0% ( 0) | |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| EASTERN EUROPE | | 0% ( 0) | 0% ( 0) | |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| LATIN AMER. & CARIB | | 20% (235) | 9% ( 13) | |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| NEAR EAST | | 7% ( 80) | 2% ( 3) | |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| NORTHERN AFRICA | | 0% ( 0) | 0% ( 0) | |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| NORTHERN AMERICA | | 0% ( 0) | 0% ( 0) | |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| OCEANIA | | 0% ( 0) | 0% ( 0) | |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| SUB-SAHARAN AFRICA | | 36% (408) | 22% ( 32) | |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
| WESTERN EUROPE | | 0% ( 0) | 0% ( 0) | |
+---------------------------------------+----+--------------------------+--------------------------+-------------------------------+
>