Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "histogram", Short: "summarize data with a histogram", Long: `Summarize data with a histogram. NOTE: This will read all data into memory. Histograms for large sets of data can be approximated with the t-digest sub-command. https://en.wikipedia.org/wiki/Histogram`, RunE: func(command *cobra.Command, args []string) (err error) { vs := []float64{} scanner := bufio.NewScanner(os.Stdin) var v float64 for scanner.Scan() { v, err = strconv.ParseFloat(scanner.Text(), 64) if err != nil { return } vs = append(vs, v) } err = scanner.Err() if err != nil { return } if len(vs) == 0 { return errors.New("No input values found.") } sort.Float64s(vs) dividers := Fence(vs) hist := stat.Histogram(nil, dividers, vs, nil) for i := 0; i < len(hist); i++ { fmt.Printf("%g %g\n", dividers[i], hist[i]) } return }, }
View Source
var (
N int = 10
)
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.