mlr --csv stats1 -a sum,mean -f salary -g dept data.csv

Category: Data Science & Analysis

mlr --csv stats1 -a sum,mean -f salary -g dept data.csv

Group by dept, then sum and average salary

stats1 with -g dept performs a group-by, splitting rows by the values in the dept field and running the aggregations within each group. This mirrors a SQL GROUP BY and is the core pattern for per-category summaries in Miller. The -a sum,mean flag list can be extended with min, max, or count. Output has one row per department.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.