library(reporttools)
library(dplyr, warn.conflicts = FALSE)

Descriptive statistics

iris %>% desc_stats()
Descriptive statistics
Variables N Mean SE SD Median Min Max Range
Sepal.Length 150 5.84 0.068 0.828 5.80 4.3 7.9 3.6
Sepal.Width 150 3.06 0.036 0.436 3.00 2.0 4.4 2.4
Petal.Length 150 3.76 0.144 1.765 4.35 1.0 6.9 5.9
Petal.Width 150 1.20 0.062 0.762 1.30 0.1 2.5 2.4
iris %>% desc_stats(norm = TRUE)
Descriptive statistics
Variables N Mean SE SD Median Min Max Range W p-value
Sepal.Length 150 5.84 0.068 0.828 5.80 4.3 7.9 3.6 0.976 0.01
Sepal.Width 150 3.06 0.036 0.436 3.00 2.0 4.4 2.4 0.985 0.101
Petal.Length 150 3.76 0.144 1.765 4.35 1.0 6.9 5.9 0.876 < 0.001
Petal.Width 150 1.20 0.062 0.762 1.30 0.1 2.5 2.4 0.902 < 0.001

\(W\) — Shapiro-Wilk Normality Test.

iris %>% group_by(Species) %>% desc_stats()
Descriptive statistics
Species Variables N Mean SE SD Median Min Max Range
setosa Sepal.Length 50 5.006 0.050 0.352 5.00 4.3 5.8 1.5
setosa Sepal.Width 50 3.428 0.054 0.379 3.40 2.3 4.4 2.1
setosa Petal.Length 50 1.462 0.025 0.174 1.50 1.0 1.9 0.9
setosa Petal.Width 50 0.246 0.015 0.105 0.20 0.1 0.6 0.5
versicolor Sepal.Length 50 5.936 0.073 0.516 5.90 4.9 7.0 2.1
versicolor Sepal.Width 50 2.770 0.044 0.314 2.80 2.0 3.4 1.4
versicolor Petal.Length 50 4.260 0.066 0.470 4.35 3.0 5.1 2.1
versicolor Petal.Width 50 1.326 0.028 0.198 1.30 1.0 1.8 0.8
virginica Sepal.Length 50 6.588 0.090 0.636 6.50 4.9 7.9 3.0
virginica Sepal.Width 50 2.974 0.046 0.322 3.00 2.2 3.8 1.6
virginica Petal.Length 50 5.552 0.078 0.552 5.55 4.5 6.9 2.4
virginica Petal.Width 50 2.026 0.039 0.275 2.00 1.4 2.5 1.1
iris %>% desc_stats_by(by = 5)
Descriptive statistics
Species Variables N Mean SE SD Median Min Max Range
setosa Sepal.Length 50 5.006 0.050 0.352 5.00 4.3 5.8 1.5
setosa Sepal.Width 50 3.428 0.054 0.379 3.40 2.3 4.4 2.1
setosa Petal.Length 50 1.462 0.025 0.174 1.50 1.0 1.9 0.9
setosa Petal.Width 50 0.246 0.015 0.105 0.20 0.1 0.6 0.5
versicolor Sepal.Length 50 5.936 0.073 0.516 5.90 4.9 7.0 2.1
versicolor Sepal.Width 50 2.770 0.044 0.314 2.80 2.0 3.4 1.4
versicolor Petal.Length 50 4.260 0.066 0.470 4.35 3.0 5.1 2.1
versicolor Petal.Width 50 1.326 0.028 0.198 1.30 1.0 1.8 0.8
virginica Sepal.Length 50 6.588 0.090 0.636 6.50 4.9 7.9 3.0
virginica Sepal.Width 50 2.974 0.046 0.322 3.00 2.2 3.8 1.6
virginica Petal.Length 50 5.552 0.078 0.552 5.55 4.5 6.9 2.4
virginica Petal.Width 50 2.026 0.039 0.275 2.00 1.4 2.5 1.1

Normality tests

norm_test(iris)
Variables W p-value
Sepal.Length 0.976 0.01
Sepal.Width 0.985 0.101
Petal.Length 0.876 < 0.001
Petal.Width 0.902 < 0.001

Statistical tests

Inline

T-test : t = -4.062; df = 9; p-value = 0.003.

1-way ANOVA: F = 138.908; num df = 2; denom df = 92.211; p-value = < 0.001 .