R - tipsR语言

几个描述数据集的R包#rstats

2019-03-14  本文已影响54人  董八七

介绍几个数据描述性统计的R包。

  1. psych::describe()
psych::describe(iris)
## 带星号的是因子
# vars   n mean   sd median trimmed  mad min max range  skew kurtosis   se
# Sepal.Length    1 150 5.84 0.83   5.80    5.81 1.04 4.3 7.9   3.6  0.31    -0.61 0.07
# Sepal.Width     2 150 3.06 0.44   3.00    3.04 0.44 2.0 4.4   2.4  0.31     0.14 0.04
# Petal.Length    3 150 3.76 1.77   4.35    3.76 1.85 1.0 6.9   5.9 -0.27    -1.42 0.14
# Petal.Width     4 150 1.20 0.76   1.30    1.18 1.04 0.1 2.5   2.4 -0.10    -1.36 0.06
# Species*        5 150 2.00 0.82   2.00    2.00 1.48 1.0 3.0   2.0  0.00    -1.52 0.07
  1. skimr::skim()
skimr::skim(iris)
# Skim summary statistics
# n obs: 150 
# n variables: 5 
# 
# -- Variable type:factor --------------------------------------------------------
#   variable missing complete   n n_unique                       top_counts ordered
# Species       0      150 150        3 set: 50, ver: 50, vir: 50, NA: 0   FALSE
# 
# -- Variable type:numeric -------------------------------------------------------
#   variable missing complete   n mean   sd  p0 p25  p50 p75 p100     hist
# Petal.Length       0      150 150 3.76 1.77 1   1.6 4.35 5.1  6.9 ▇▁▁▂▅▅▃▁
# Petal.Width       0      150 150 1.2  0.76 0.1 0.3 1.3  1.8  2.5 ▇▁▁▅▃▃▂▂
# Sepal.Length       0      150 150 5.84 0.83 4.3 5.1 5.8  6.4  7.9 ▂▇▅▇▆▅▂▂
# Sepal.Width       0      150 150 3.06 0.44 2   2.8 3    3.3  4.4 ▁▂▅▇▃▂▁▁
  1. summarytools::dfSummary(iris)
library(summarytools)
view(dfSummary(iris))
上一篇下一篇

猜你喜欢

热点阅读