[R] dplyr summarize by groups
tgs77m m@iii@g oii y@hoo@com
tgs77m m@iii@g oii y@hoo@com
Sat Nov 23 06:52:47 CET 2024
# Get mean, min, max sigma and skew by group
options (digits = 3)
library (ISwR
data(energy)
data %>%
group_by(stature) %>%
summarize(
Mean = mean(expend),
Min = min(expend),
Max = max(expend),
Sigma = sd(expend),
Skew = skew(expend))
# Output
stature Mean Min Max Sigma Skew
<fct> <dbl> <dbl> <dbl> <dbl> <dbl>
1 lean 8.07 6.13 10.9 1.24 0.907
2 obese 10.3 8.79 12.8 1.40 0.587
Why does output stats vary in decimal places even when options (digits=3)
were set?
All the best
Thomas S.
[[alternative HTML version deleted]]
More information about the R-help
mailing list