在R语言中显示美丽的数据摘要summary统计信息

在R语言中显示美丽的数据摘要summary统计信息

总结数据集

## Skim summary statistics
##  n obs: 150 
##  n variables: 5 
## 
## Variable type: factor 
##   variable missing complete   n n_unique                       top_counts
## 1  Species       0      150 150        3 set: 50, ver: 50, vir: 50, NA: 0
##   ordered
## 1   FALSE
## 
## Variable type: numeric 
##       variable missing complete   n mean   sd min p25 median p75 max
## 1 Petal.Length       0      150 150 3.76 1.77 1   1.6   4.35 5.1 6.9
## 2  Petal.Width       0      150 150 1.2  0.76 0.1 0.3   1.3  1.8 2.5
## 3 Sepal.Length       0      150 150 5.84 0.83 4.3 5.1   5.8  6.4 7.9
## 4  Sepal.Width       0      150 150 3.06 0.44 2   2.8   3    3.3 4.4
##       hist
## 1 ▇▁▁▂▅▅▃▁
## 2 ▇▁▁▅▃▃▂▂
## 3 ▂▇▅▇▆▅▂▂
## 4 ▁▂▅▇▃▂▁▁

选择要汇总的特定列

## Skim summary statistics
##  n obs: 150 
##  n variables: 5 
## 
## Variable type: numeric 
##       variable missing complete   n mean   sd min p25 median p75 max
## 1 Petal.Length       0      150 150 3.76 1.77 1   1.6   4.35 5.1 6.9
## 2 Sepal.Length       0      150 150 5.84 0.83 4.3 5.1   5.8  6.4 7.9
##       hist
## 1 ▇▁▁▂▅▅▃▁
## 2 ▂▇▅▇▆▅▂▂

处理分组数据

可以处理已使用分组的数据dplyr::group_by

## Skim summary statistics
##  n obs: 150 
##  n variables: 5 
##  group variables: Species 
## 
## Variable type: numeric 
##       Species     variable missing complete  n mean   sd min  p25 median
## 1      setosa Petal.Length       0       50 50 1.46 0.17 1   1.4    1.5 
## 2      setosa  Petal.Width       0       50 50 0.25 0.11 0.1 0.2    0.2 
## 3      setosa Sepal.Length       0       50 50 5.01 0.35 4.3 4.8    5   
## 4      setosa  Sepal.Width       0       50 50 3.43 0.38 2.3 3.2    3.4 
## 5  versicolor Petal.Length       0       50 50 4.26 0.47 3   4      4.35
## 6  versicolor  Petal.Width       0       50 50 1.33 0.2  1   1.2    1.3 
## 7  versicolor Sepal.Length       0       50 50 5.94 0.52 4.9 5.6    5.9 
## 8  versicolor  Sepal.Width       0       50 50 2.77 0.31 2   2.52   2.8 
## 9   virginica Petal.Length       0       50 50 5.55 0.55 4.5 5.1    5.55
## 10  virginica  Petal.Width       0       50 50 2.03 0.27 1.4 1.8    2   
## 11  virginica Sepal.Length       0       50 50 6.59 0.64 4.9 6.23   6.5 
## 12  virginica  Sepal.Width       0       50 50 2.97 0.32 2.2 2.8    3   
##     p75 max     hist
## 1  1.58 1.9 ▁▁▅▇▇▅▂▁
## 2  0.3  0.6 ▂▇▁▂▂▁▁▁
## 3  5.2  5.8 ▂▃▅▇▇▃▁▂
## 4  3.68 4.4 ▁▁▃▅▇▃▂▁
## 5  4.6  5.1 ▁▃▂▆▆▇▇▃
## 6  1.5  1.8 ▆▃▇▅▆▂▁▁
## 7  6.3  7   ▃▂▇▇▇▃▅▂
## 8  3    3.4 ▁▂▃▅▃▇▃▁
## 9  5.88 6.9 ▂▇▃▇▅▂▁▂
## 10 2.3  2.5 ▂▁▇▃▃▆▅▃
## 11 6.9  7.9 ▁▁▃▇▅▃▂▃
## 12 3.18 3.8 ▁▃▇▇▅▃▁▂

指定统计信息和类

用户可以使用与该skim_with()功能组合的列表来指定自己的统计信息。

## Skim summary statistics
##  n obs: 150 
##  n variables: 5 
## 
## Variable type: numeric 
##       variable iqr  mad
## 1 Sepal.Length 1.3 1.04

可下载资源

关于作者

Kaizong Ye拓端研究室(TRL)的研究员。

本文借鉴了作者最近为《R语言数据分析挖掘必知必会 》课堂做的准备。

​非常感谢您阅读本文,如需帮助请联系我们!

 
QQ在线咨询
售前咨询热线
15121130882
售后咨询热线
0571-63341498

关注有关新文章的微信公众号


永远不要错过任何见解。当新文章发表时,我们会通过微信公众号向您推送。

技术干货

最新洞察

This will close in 0 seconds