本文于2020-10-10更新。 如发现问题或者有建议,欢迎提交 Issue
相关笔记已经整理到 Gitbook 上。
1 skimr
library(skimr)
## Warning: 程辑包'skimr'是用R版本3.6.3 来建造的
skim(chickwts)
Name | chickwts |
Number of rows | 71 |
Number of columns | 2 |
_______________________ | |
Column type frequency: | |
factor | 1 |
numeric | 1 |
________________________ | |
Group variables | None |
Variable type: factor
skim_variable | n_missing | complete_rate | ordered | n_unique | top_counts |
---|---|---|---|---|---|
feed | 0 | 1 | FALSE | 6 | soy: 14, cas: 12, lin: 12, sun: 12 |
Variable type: numeric
skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
---|---|---|---|---|---|---|---|---|---|---|
weight | 0 | 1 | 261.31 | 78.07 | 108 | 204.5 | 258 | 323.5 | 423 | ▆▆▇▇▃ |
- 注意看,这里有几种信息,关键是变量名称作为变量,可以看好几百变量的table。
1.1 连续变量
- 但是耗时太长,因此不建议使用,这里推荐
psych::describe
, 具体参考 因子分析 Factor Analysis
psych::describe(chickwts)
## vars n mean sd median trimmed mad min max range skew kurtosis
## weight 1 71 261.31 78.07 258 261.0 91.92 108 423 315 -0.01 -0.97
## feed* 2 71 3.58 1.73 4 3.6 1.48 1 6 5 -0.10 -1.32
## se
## weight 9.27
## feed* 0.21
Variable type: numeric
variable missing complete n mean sd p0 p25 median p75 p100 hist
weight 0 71 71 261.31 78.07 108 204.5 258 323.5 423 ▃▅▅▇▃▇▂▂
反馈缺失值。
missing complete n n_unique
0 71 71 6
反馈均值和标准差。
Variable type: numeric
mean sd
261.31 78.07
对于有skew的,代表了直方图。
p0 p25 median p75 p100
108 204.5 258 323.5 423
还可以看hist。
hist
▃▅▅▇▃▇▂▂
1.2 分类变量
Variable type: factor
variable missing complete n n_unique top_counts ordered
feed 0 71 71 6 soy: 14, cas: 12, lin: 12, sun: 12 FALSE
唯一值
n_unique
6
各分类的数量
top_counts
soy: 14, cas: 12, lin: 12, sun: 12
很棒的包,替代了str()
了。