({{, (RefLink[BinLists, paclet:ref/BinLists])[{(Subscript[x, 1]),(Subscript[x, 2]),…}]
gives lists of the elements (Subscript[x, i]) whose values lie in successive integer bins.}, {, (RefLink[BinLists, paclet:ref/BinLists])[{(Subscript[x, 1]),(Subscript[x, 2]),…},dx] 
gives lists of the elements (Subscript[x, i]) whose values lie in successive bins of width dx.}, {, (RefLink[BinLists, paclet:ref/BinLists])[{(Subscript[x, 1]),(Subscript[x, 2]),…},{(Subscript[x, min]),(Subscript[x, max]),dx}]
gives lists of the (Subscript[x, i]) that lie in successive bins of width dx from (Subscript[x, min]) to (Subscript[x, max]). }, {, (RefLink[BinLists, paclet:ref/BinLists])[{(Subscript[x, 1]),(Subscript[x, 2]),…},{{(Subscript[b, 1]),(Subscript[b, 2]),…}}]
gives lists of the (Subscript[x, i]) that lie in the intervals [(Subscript[b, 1]),(Subscript[b, 2])), [(Subscript[b, 2]),(Subscript[b, 3])), …. }, {, (RefLink[BinLists, paclet:ref/BinLists])[{{(Subscript[x, 1]),(Subscript[y, 1]),…},{(Subscript[x, 2]),(Subscript[y, 2]),…},…},xbins,ybins,…]
gives an array of lists where the first index corresponds to x bins, the second to y, and so on. }})

OpenersNotesSection(Spacer1)Details

(RefLink[BinLists, paclet:ref/BinLists]) drops elements whose values do not correspond to real numbers.

Within each bin, elements appear in the same order as in the original data.

(RefLink[BinLists, paclet:ref/BinLists])[data,dx] takes the bin boundaries to be integer multiples of dx, with the first bin starting at (RefLink[Ceiling, paclet:ref/Ceiling])[(RefLink[Min, paclet:ref/Min])[data]-dx,dx] and the last bin ending at (RefLink[Floor, paclet:ref/Floor])[(RefLink[Max, paclet:ref/Max])[data]+dx,dx].

(RefLink[BinLists, paclet:ref/BinLists])[data] is equivalent to (RefLink[BinLists, paclet:ref/BinLists])[data,1].

(RefLink[BinLists, paclet:ref/BinLists])[data,{(Subscript[x, min]),(Subscript[x, max])}] is equivalent to (RefLink[BinLists, paclet:ref/BinLists])[data,{(Subscript[x, min]),(Subscript[x, max]),1}].

In (RefLink[BinLists, paclet:ref/BinLists])[data,{(Subscript[x, min]),(Subscript[x, max]),dx}], elements are placed in bin i when their values satisfy (Subscript[x, min])+(i-1) dx≤x<(Subscript[x, min])+i dx.

In the form (RefLink[BinLists, paclet:ref/BinLists])[data,{{(Subscript[b, 1]),(Subscript[b, 2]),…}}], the (Subscript[b, i]) at each end can be -(RefLink[Infinity, paclet:ref/Infinity]) and +(RefLink[Infinity, paclet:ref/Infinity]).

If the (Subscript[b, i]) do not form an increasing sequence, they are automatically sorted by (RefLink[BinLists, paclet:ref/BinLists]).

In (RefLink[BinLists, paclet:ref/BinLists])[data,{{(Subscript[b, 1]),(Subscript[b, 2]),…}}], elements are put in bin i when their values satisfy (Subscript[b, i])≤x<(Subscript[b, i+1]).

If data consists of length-n sublists, then n bin specifications must be given, and (RefLink[BinLists, paclet:ref/BinLists])[data,…] yields an array of lists of depth n.

(RefLink[BinLists, paclet:ref/BinLists]) works with (RefLink[SparseArray, paclet:ref/SparseArray]) objects.

OpenersPrimaryExamplesSection(Spacer1)Examples  (13)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Make lists of elements in bins of width 1 from 0 to 10:

BinLists[{1,3,2,1,4,5,6,2},{0,10,1}]

List elements in a sequence of ranges:

BinLists[{1,3,2,1,4,5,6,2},{{-Infinity,2,5,7,Infinity}}]

List elements in bins of a specified width:

BinLists[{1,3,2,1,4,5,6,2},2]

OpenersExampleSection1(Spacer1)Scope  (7)

List squares mod 3 and 5 in two-dimensional unit bins:

BinLists[Table[Mod[i^2,{3,5}],{i,20}],1,1]

List random pairs in bins of width 0.25 in both dimensions:

BinLists[RandomReal[{-1,1},{10,2}],{-1,1,.25},{-1,1,.25}]

List multidimensional data in ranges:

BinLists[RandomReal[{-1,1},{10,2}],{{-2,.3,2}},{{-1,-.4,.2,1}}]

Bin data in any dimension:

BinLists[RandomReal[{-1,1},{10,4}]]

Bin data, ignoring values that are not real:

BinLists[{1.5,3,a,2.5,1,I},2]

Bin data of any precision:

BinLists[{1.5,3,N[3,20],2.5,1,E},2]

Bin data from a time series:

ts=TimeSeries[];

BinLists[ts]

The time stamps are ignored:

BinLists[ts["Values"]]

%==%%

OpenersExampleSection2(Spacer1)Applications  (1)

Visualize two-dimensional data in bins:

Flatten[BinLists[RandomReal[10,{2500,2}],2,2],1]//ListPlot

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

The length of (RefLink[BinLists, paclet:ref/BinLists]) is equivalent to the results from (RefLink[BinCounts, paclet:ref/BinCounts]):

data=RandomReal[{-5,5},1000];

Map[Length,BinLists[data]]

BinCounts[data]

data2=RandomReal[{-5,5},{1000,2}];

Map[Length,BinLists[data2],{2}]==BinCounts[data2]

OpenersExampleSection4(Spacer1)Possible Issues  (1)

Binning intervals are closed on the left:

BinLists[{1,2,3,4,5}]

BinLists[{1-$MachineEpsilon,2,3,4,5}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[BinCounts, paclet:ref/BinCounts])  ▪  (RefLink[Cases, paclet:ref/Cases])  ▪  (RefLink[Union, paclet:ref/Union])  ▪  (RefLink[Sort, paclet:ref/Sort])  ▪  (RefLink[Gather, paclet:ref/Gather])  ▪  (RefLink[GatherBy, paclet:ref/GatherBy])  ▪  (RefLink[Split, paclet:ref/Split])  ▪  (RefLink[FindDivisions, paclet:ref/FindDivisions])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Discrete & Integer Data, paclet:guide/DiscreteAndIntegerData])}, {▪(RefLinkPlain[Elements of Lists, paclet:guide/ElementsOfLists])}})}})