mlr --csv put -S '$pct = $score * 100' data.csv

Category: Data Science & Analysis

mlr --csv put -S '$pct = $score * 100' data.csv

Add a percentage column, keeping the value as text

The -S flag makes put treat the computed value as a string instead of guessing a numeric type. Without it Miller would infer the type of the new pct field, which can change downstream formatting. The -S option is useful when you want to preserve leading zeros or exact text. Miller normally infers types, so this flag exists for when that inference is wrong.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.