R code gets easier and more readable
University of Münster
2025-10-30
%>% operator.%>%%>% takes the return of a function and pipes it to the next function.
mtcars data set (included in base R).describe() function from the psych library (make sure you have installed psych).round() is your friend here).%>% to do this all.tidyverse library :-):-)
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| mpg | 1 | 32 | 20.1 | 6.0 | 19.2 | 19.7 | 5.4 | 10.4 | 33.9 | 23.5 | 0.6 | -0.4 | 1.1 |
| cyl | 2 | 32 | 6.2 | 1.8 | 6.0 | 6.2 | 3.0 | 4.0 | 8.0 | 4.0 | -0.2 | -1.8 | 0.3 |
| disp | 3 | 32 | 230.7 | 123.9 | 196.3 | 222.5 | 140.5 | 71.1 | 472.0 | 400.9 | 0.4 | -1.2 | 21.9 |
| hp | 4 | 32 | 146.7 | 68.6 | 123.0 | 141.2 | 77.1 | 52.0 | 335.0 | 283.0 | 0.7 | -0.1 | 12.1 |
| drat | 5 | 32 | 3.6 | 0.5 | 3.7 | 3.6 | 0.7 | 2.8 | 4.9 | 2.2 | 0.3 | -0.7 | 0.1 |
| wt | 6 | 32 | 3.2 | 1.0 | 3.3 | 3.2 | 0.8 | 1.5 | 5.4 | 3.9 | 0.4 | 0.0 | 0.2 |
| qsec | 7 | 32 | 17.8 | 1.8 | 17.7 | 17.8 | 1.4 | 14.5 | 22.9 | 8.4 | 0.4 | 0.3 | 0.3 |
| vs | 8 | 32 | 0.4 | 0.5 | 0.0 | 0.4 | 0.0 | 0.0 | 1.0 | 1.0 | 0.2 | -2.0 | 0.1 |
| am | 9 | 32 | 0.4 | 0.5 | 0.0 | 0.4 | 0.0 | 0.0 | 1.0 | 1.0 | 0.4 | -1.9 | 0.1 |
| gear | 10 | 32 | 3.7 | 0.7 | 4.0 | 3.6 | 1.5 | 3.0 | 5.0 | 2.0 | 0.5 | -1.1 | 0.1 |
| carb | 11 | 32 | 2.8 | 1.6 | 2.0 | 2.7 | 1.5 | 1.0 | 8.0 | 7.0 | 1.1 | 1.3 | 0.3 |
Jürgen Wilbert - Introduction to R