Skip to main content

## summary

The summary command applies summarisation functions on CSV input data. The currently available functions are:

average - compute the average (mean) of individual numeric fields

frequency - provide frequency information on aggregated fields

median - compute median values for individual numeric fields

mode - identify modal records based on aggregated fields

min/max - identify minimum and maximum values for individual fields

sum - perform numeric summation on individual numeric fields

All of the above use the same format:
csvfix summary -flag fields
where -flag specifies the operation and fields is a list of field indexes to apply the operation to. Only a single flag can be specified per command.
See also: eval

Flag | Req'd? | Description
-avg fields | No | Calculates the numeric average of the each of the fields specified. The input fields must all be numeric.The output is single row of CSV data containing the averages.
-frq fields | No | Calculates the frequency with which the aggregated fields values, considered as a key, appear in the input. The output is identical to the input, but with the frequency prepended.
-max fields | No | Identifies the maximum values for the specified fields. The output is a single row of CSV data.
-med fields | No | Calculates the median values of the specified fields. The input fields must all be numeric. The output is a single row of CSV data.
-min fields | No | Identifies the minimum values for the specified fields. The output is a single row of CSV data.
-mod fields | No | Identifies the modal values for the specified fields. As with the -frq flag, the field contents are considered to be a single key. The output is one or more rows of CSV data identifying the modal values.
-sum fields | No | Performs arithmetic summation on the individual specified fields. The output is a single row of CSV data.

The following example calculates the averages of the two fields in numbers.csv:
csvfix summary -avg 1,2 data/numbers.csv
which produces:
"3","39.5"
This example adds frequency information regarding country (the second field in the input) to the data in cities.csv:
csvfix summary -frq 2 data/cities.csv
producing:
"2","London","GB"
"1","Paris","FR"
"2","Edinburgh","GB"
"1","Amsterdam","NL"
"1","Rome","IT"
"1","Athens","GR"
"1","Berlin","DE"

Created with the Personal Edition of HelpNDoc: iPhone web sites made easy

####