# Turn off printing for CRAN checks
options("procs.print" = FALSE)
# Default statistics on iris
res1 <- proc_means(iris)
# View results
res1
# TYPE FREQ VAR N MEAN STD MIN MAX
# 1 0 150 Sepal.Length 150 5.843333 0.8280661 4.3 7.9
# 2 0 150 Sepal.Width 150 3.057333 0.4358663 2.0 4.4
# 3 0 150 Petal.Length 150 3.758000 1.7652982 1.0 6.9
# 4 0 150 Petal.Width 150 1.199333 0.7622377 0.1 2.5
# Defaults statistics with by
res2 <- proc_means(iris,
by = Species)
# View results
res2
# BY TYPE FREQ VAR N MEAN STD MIN MAX
# 1 setosa 0 50 Sepal.Length 50 5.006 0.3524897 4.3 5.8
# 2 setosa 0 50 Sepal.Width 50 3.428 0.3790644 2.3 4.4
# 3 setosa 0 50 Petal.Length 50 1.462 0.1736640 1.0 1.9
# 4 setosa 0 50 Petal.Width 50 0.246 0.1053856 0.1 0.6
# 5 versicolor 0 50 Sepal.Length 50 5.936 0.5161711 4.9 7.0
# 6 versicolor 0 50 Sepal.Width 50 2.770 0.3137983 2.0 3.4
# 7 versicolor 0 50 Petal.Length 50 4.260 0.4699110 3.0 5.1
# 8 versicolor 0 50 Petal.Width 50 1.326 0.1977527 1.0 1.8
# 9 virginica 0 50 Sepal.Length 50 6.588 0.6358796 4.9 7.9
# 10 virginica 0 50 Sepal.Width 50 2.974 0.3224966 2.2 3.8
# 11 virginica 0 50 Petal.Length 50 5.552 0.5518947 4.5 6.9
# 12 virginica 0 50 Petal.Width 50 2.026 0.2746501 1.4 2.5
# Specified variables, statistics, and options
res3 <- proc_means(iris,
var = v(Petal.Length, Petal.Width),
class = Species,
stats = v(n, mean, std, median, qrange, clm),
options = nofreq,
output = long)
# View results
res3
# CLASS TYPE STAT Petal.Length Petal.Width
# 1 0 N 150.0000000 150.0000000
# 2 0 MEAN 3.7580000 1.1993333
# 3 0 STD 1.7652982 0.7622377
# 4 0 MEDIAN 4.3500000 1.3000000
# 5 0 QRANGE 3.5000000 1.5000000
# 6 0 LCLM 3.4731854 1.0763533
# 7 0 UCLM 4.0428146 1.3223134
# 8 setosa 1 N 50.0000000 50.0000000
# 9 setosa 1 MEAN 1.4620000 0.2460000
# 10 setosa 1 STD 0.1736640 0.1053856
# 11 setosa 1 MEDIAN 1.5000000 0.2000000
# 12 setosa 1 QRANGE 0.2000000 0.1000000
# 13 setosa 1 LCLM 1.4126452 0.2160497
# 14 setosa 1 UCLM 1.5113548 0.2759503
# 15 versicolor 1 N 50.0000000 50.0000000
# 16 versicolor 1 MEAN 4.2600000 1.3260000
# 17 versicolor 1 STD 0.4699110 0.1977527
# 18 versicolor 1 MEDIAN 4.3500000 1.3000000
# 19 versicolor 1 QRANGE 0.6000000 0.3000000
# 20 versicolor 1 LCLM 4.1264528 1.2697993
# 21 versicolor 1 UCLM 4.3935472 1.3822007
# 22 virginica 1 N 50.0000000 50.0000000
# 23 virginica 1 MEAN 5.5520000 2.0260000
# 24 virginica 1 STD 0.5518947 0.2746501
# 25 virginica 1 MEDIAN 5.5500000 2.0000000
# 26 virginica 1 QRANGE 0.8000000 0.5000000
# 27 virginica 1 LCLM 5.3951533 1.9479453
# 28 virginica 1 UCLM 5.7088467 2.1040547
Run the code above in your browser using DataLab