Count the number of elements of a given matrix z=z(x,y) that fall within successive pairs of breaks in x and y.

binCount2D(x, y, xbreaks, ybreaks, flatten = FALSE)



vector of numerical values.


vector of numerical values.


Vector of values of x at the boundaries between bins, calculated using [pretty``](x)` if not supplied.


Vector of values of y at the boundaries between bins, calculated using pretty(y) if not supplied.


A logical value indicating whether the return value also contains equilength vectors x, y, z and n, a flattened representation of xmids, ymids, result and number.


A list with the following elements: the breaks (xbreaks and ybreaks), the midpoints (xmids and ymids) between those breaks, and the count (number) of f values in the boxes defined between successive breaks.

See also

Other bin-related functions: binApply1D(), binApply2D(), binAverage(), binCount1D(), binMean1D(), binMean2D()