Wolfram Research

Function Repository Resource:

BinCountAssociation

Source Notebook

Collect histogram data in an association of bin intervals and bin heights

Contributed by: Wolfram Research

ResourceFunction["BinCountAssociation"][{x1,x2,}]

gives an association of bin intervals and histogram heights of the values xi.

ResourceFunction["BinCountAssociation"][data,bspec]

gives an association of bin intervals and histogram heights with bins specified by bspec.

ResourceFunction["BinCountAssociation"][data,bspec,hspec]

gives an association of bin intervals and histogram heights with bin heights computed according to the specification hspec.

Details and Options

ResourceFunction["BinCountAssociation"][data,bspec] and ResourceFunction["BinCountAssociation"][data,bspec,hspec] follow the same conventions as in HistogramList.

Examples

Basic Examples

Generate an association of bin intervals and heights:

In[1]:=
ResourceFunction["BinCountAssociation"][
 RandomVariate[NormalDistribution[], 200]]
Out[1]=

Use unit width bins:

In[2]:=
ResourceFunction["BinCountAssociation"][
 RandomVariate[NormalDistribution[], 100], {1}]
Out[2]=

Use different height functions:

In[3]:=
data = RandomVariate[NormalDistribution[], 100];
In[4]:=
ResourceFunction["BinCountAssociation"][data, {1}, "Count"]
Out[4]=
In[5]:=
ResourceFunction["BinCountAssociation"][data, {1}, "PDF"]
Out[5]=
In[6]:=
ResourceFunction["BinCountAssociation"][data, {1}, "CDF"]
Out[6]=

Resource History

License Information