mlr --csv merge-fields -a sum -f salary,score -o total data.csv

Category: Data Science & Analysis

mlr --csv merge-fields -a sum -f salary,score -o total data.csv

Add a total column summing salary and score

The merge-fields verb combines several fields into one; -a sum adds them and -o total names the new column. The original salary and score fields are removed from the output. This is a fast way to build row totals without writing a put expression. Use -a mean or min to combine fields with other operations.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.