Skip to content

unixpickle/agg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agg

agg is a simple command to compute numerical aggregates (e.g. averages and sums) in the shell. I constantly find myself wanting something like this, and all the popular approaches are a hassle.

Installation

You must install Go and setup a GOPATH. You will also want to add $GOPATH/bin to your $PATH.

Once you have Go, simply run:

go get github.com/unixpickle/agg

You should now have an agg command in $GOPATH/bin.

Example

Suppose we have a file containing some house prices, called prices.txt:

1500
2700
3200
2000
4500

We can compute the mean house price like so:

$ cat prices.txt | agg mean
2780

Detailed Usage

The stdin to agg should be a list of real numbers, separated by whitespace. If your data does not look like this, you can likely use sed, tr, and cut as part of your pipeline (on UNIX).

You can see detailed usage info by running agg with no arguments:

$ agg
Usage: agg <aggregate type>

Available aggregate types:
  geommean    geometric mean
  max         maximum value
  mean        arithmetic mean
  min         minimum value
  stddev      standard deviation (with Bessel's correction)
  sum         basic sum
  variance    variance (with Bessel's correction)

About

Command-line tool for numerical aggregates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages