Returns the measures of location such as range, variance and standard deviation.
ds_measures_variation(data, ..., decimals = 2)
data | A |
---|---|
... | Column(s) in |
decimals | An option to specify the exact number of decimal places to use. The default number of decimal places is 2. |
# single column ds_measures_variation(mtcarz, mpg)#> # A tibble: 1 x 8 #> var n range iqr variance sd coeff_var std_error #> <chr> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 mpg 32 23.5 7.38 36.3 6.03 30.0 1.07# multiple columns ds_measures_variation(mtcarz, mpg, disp)#> # A tibble: 2 x 8 #> var n range iqr variance sd coeff_var std_error #> <chr> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 disp 32 401. 205. 15361. 124. 53.7 21.9 #> 2 mpg 32 23.5 7.38 36.3 6.03 30.0 1.07# all columns ds_measures_variation(mtcarz)#> # A tibble: 6 x 8 #> var n range iqr variance sd coeff_var std_error #> <chr> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 disp 32 401. 205. 15361. 124. 53.7 21.9 #> 2 drat 32 2.17 0.840 0.286 0.535 14.9 0.0945 #> 3 hp 32 283 83.5 4701. 68.6 46.7 12.1 #> 4 mpg 32 23.5 7.38 36.3 6.03 30.0 1.07 #> 5 qsec 32 8.40 2.01 3.19 1.79 10.0 0.316 #> 6 wt 32 3.91 1.03 0.957 0.978 30.4 0.173# vector ds_measures_variation(mtcarz$mpg)#> variable n range iqr variance sd coeff_var std_error #> 1 mpg 32 23.5 7.38 36.32 6.03 30 1.07# vectors of different length disp <- mtcarz$disp[1:10] ds_measures_variation(mtcarz$mpg, disp)#> variable n range iqr variance sd coeff_var std_error #> 1 mtcarz$mpg 32 23.5 7.38 36.32 6.03 30.00 1.07 #> 2 disp 10 252.0 99.73 8167.44 90.37 43.32 28.58# decimal places ds_measures_variation(mtcarz, disp, hp, decimals = 3)#> # A tibble: 2 x 8 #> var n range iqr variance sd coeff_var std_error #> <chr> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 disp 32 401. 205. 15361. 124. 53.7 21.9 #> 2 hp 32 283 83.5 4701. 68.6 46.7 12.1