Given a set of elements, I would love to efficiently partition their numerical values into bins, and then return the count in each bin, as well as the bin edges.
MATLAB used to have super simple functions for this (i.e. hist, and histc). I wrote my own (quick and dirty) code. Which is the best (and simplest) way to do it ?
Note: I don’t care about plotting - I need to do subsequent analysis on the bins and the counts.
Thanks for your patience and help.
julia> using StatsBase
julia> result = fit(Histogram, randn(1000))
StatsBase.Histogram{Int64,1,Tuple{FloatRange{Float64}}}
edges:
-4.0:1.0:4.0
weights: [2,24,131,361,342,129,10,1]
closed: right
Replace the randn(1000) in the code above with the vector your are working with.
You can access the properties of the result using result.edges and result.weights.